473,473 Members | 2,167 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

set iframe src to file input value?

I assume the answer to this is "no" with no workarounds, but just checking.

I have a page I open locally from my filesystem for "scrubbing"
Microsoft Word generated junk from HTML. In Firefox 2, I could simply
click on a Browse button to pick a file. The Javascript would set the
SRC of an IFRAME to that file (mangled to file: form), get the content,
scrub it, and dump the output in another window for saving.

In Firefox 3, this doesn't work because FILE INPUT value is just the
file name, e.g., foo.html, not the entire path. I understand why this is so.

I tried giving my HTML file UniversalBrowserRead capability, though I
may have done that wrong. It didn't help. Should that work? Is there an
alternative? Or am I back to the older interface where I to copy and
paste the HTML manually from a text editor?
Sep 9 '08 #1
2 3063
Chris Riesbeck wrote:
In Firefox 2, I could simply click on a Browse button to pick a file. The
Javascript would set the SRC of an IFRAME to that file (mangled to file:
form), get the content, scrub it, and dump the output in another window
for saving.

In Firefox 3, this doesn't work because FILE INPUT value is just the file
name, e.g., foo.html, not the entire path. I understand why this is so.

I tried giving my HTML file UniversalBrowserRead capability, though I may
have done that wrong.
You need to set the pref `signed.applets.codebase_principal_support'
to `true' (default is `false') for privilege requests to work. Then

netscape.security.PrivilegeManager.enablePrivilege ("UniversalBrowserRead")

does not throw an exception. But it does not seem to help with the `value'
property either, nor does attempting to get any other privilege.
It didn't help. Should that work?
Apparently not.
Is there an alternative?
A) Using input.files[0].getAsText("target-encoding") to set
iframe.contentDocument.body.textContent and the like. Turns out you
can even use getAsBinary() or getAsDataURI() without requesting
any privileges. That's quite a security logic, isn't it?

B) Submitting a bug report, or voting on an existing bug that targets this
pointless misbehavior.
Or am I back to the older interface where I to copy and
paste the HTML manually from a text editor?
Unlikely, although I consider this crippling input[type=file] and even XHR
beyond use for scripting a major bug. There is no good reason why that
needs to be, especially not security: from my filesystem, I should be
allowed to do everything that the OS permissions of my user account would
allow me to do.
PointedEars
--
Prototype.js was written by people who don't know javascript for people
who don't know javascript. People who don't know javascript are not
the best source of advice on designing systems that use javascript.
-- Richard Cornford, cljs, <f8*******************@news.demon.co.uk>
Sep 9 '08 #2
SAM
Chris Riesbeck a écrit :
I assume the answer to this is "no" with no workarounds, but just checking.

I have a page I open locally from my filesystem for "scrubbing"
Microsoft Word generated junk from HTML. In Firefox 2, I could simply
click on a Browse button to pick a file. The Javascript would set the
SRC of an IFRAME to that file (mangled to file: form), get the content,
scrub it, and dump the output in another window for saving.

In Firefox 3, this doesn't work because FILE INPUT value is just the
file name, e.g., foo.html, not the entire path. I understand why this is
so.

I tried giving my HTML file UniversalBrowserRead capability, though I
may have done that wrong. It didn't help.
It's not the alone bug about path of local files in this version of Fx
:-(

--
sm
Sep 9 '08 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: coolsti | last post by:
I need some help here. I am making an application which allows a user to look at a series of picture files one at a time, and enter the outcome of various visual tests to a database. The...
6
by: paul | last post by:
HI! How do we send a variable from an Iframe page back to its parent? I have a script that calculates the iframe's window size but I need to know how to send that value back to its parent so I...
3
by: matwilko | last post by:
hi, i am trying to create a simple version of itunes...and i am using iframes to do this. I have already set up the iframes using dreamweaver and used a drop-down menu to select the genre. When...
1
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
1
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
muto222
php
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.