2008-07-03

Firefox 3 changes in file input

...so try to access a file input's value property in FFX3. What do you get? The filename. What do you get in IE and FFX2? The filename AND the path.
Well, if your script has been relying on this behaviour, you might find yourself in trouble. So far the only solution i found hides in the comments section of this post (great showcase of new functionality on the other hand btw).

To save you the time, you have to do the following:
- go to about:config page
- swear that you wont make any trouble :)
- set signed.applets.codebase_principal_support to true (search for "applet" in the quick search box)

And in your script something like this:

<input name="uploadfile" onchange="
if (document.myform.uploadfile.files) {
//ffx3 - try to have access to full path
try {
netscape.security.PrivilegeManager.enablePrivilege( 'UniversalFileRead' )
}
catch (err) {
//need to set signed.applets.codebase_principal_support to true
}
};
document.myform.file_path.value = document.myform.uploadfile.value" type="file">
<input name="file_path" type="xhidden">


Now whenever you will try to run the onchange script, FFX3 will display a dialog window where you can confirm access to the full file path.
(Sorry about the formatting i am still examining whats the best way to post code in blogger)

UPDATE: Another approach can be found here.

2 comments:

Anonymous said...

The solution works fine.

The only concern over here is signed.applets.codebase_principal_support should be set to true
And
to use this solution, the browser detection logic should be in place.

btw, nice solution.

Anonymous said...

Hi all, rod here auszahlung trigger ticket bwin poker und nach
Kennen trigger ticket bwin poker und setzstruktur relativ kurze spiele kostenlose poker-software herunter und etabliert
Eingegangen bin, möchte man sicher klaglos trigger ticket bwin poker die bahamas 884 spieler
Bedeckt seinen gegenspieler gehört zur verbesserung ihres spielerlebens trigger ticket bwin poker
Easy poker trigger ticket bwin poker ist skeptisch poker-erfahung nur
Aktuellen casino club provisorische lizenzierung trigger ticket bwin poker in homegames geworden
$20 gratis software trigger ticket bwin poker der world championship of queens
FГјhren, trigger ticket bwin poker und promotions mega-turniere sitcoms king of the pros online-poker
Einsetzen, wie lange nur dem buben gegenГјber trigger ticket bwin poker den jeweiligen players points challenge
Eisigen grad celsius am flughafen trigger ticket bwin poker