/    Sign up×
Community /Pin to ProfileBookmark

how to work around to display a local photo in Firefox???

My project involves selecting a local image and displays it locally before uploading.
The related javascript statements are as below.

function showPhoto() {
var str = document.getElementById(‘photo_T’).value
document.getElementById(‘showPic’).innerHTML
='<img src=”‘ + “file://” + str + ‘” height=”130″ style=float:right></img>’;
}

This is to get the photo image locally and to display it in Firefox browser for user’s decision whether or not he/she would go further for uploading.
Above code works fine and displays a perfect image with IE browser. But, it does not work with Firefox.

Any feedback or guidance will be appreciated.

to post a comment
JavaScript

4 Comments(s)

Copy linkTweet thisAlerts:
@erh11Oct 19.2007 — I have had this issue before writing dynamic upload code for images and I think what is happening is that Firefox is adding full quotes to the file string whereare IE does not.

Give that approach a try.
Copy linkTweet thisAlerts:
@jcckingauthorOct 19.2007 — I have had this issue before writing dynamic upload code for images and I think what is happening is that Firefox is adding full quotes to the file string whereare IE does not.

Give that approach a try.[/QUOTE]



That's why I add "file://" to replace Firefox's leading path, and turn the URI into a correct one. But, it still doesn't work. With the same URI, IE browser can display local photo without problems.

Is there any workaround to settle this Firefox issue?

So, the web page can work on Firefox browser as well as IE's.

Further feedback is appreciated.
Copy linkTweet thisAlerts:
@Arty_EffemOct 19.2007 — 
function showPhoto() {

var str = document.getElementById('photo_T').value

document.getElementById('showPic').innerHTML

='<img src="' + "file://" + str + '" height="130" style=float:right></img>';

}

This is to get the photo image locally and to display it in Firefox browser for user's decision whether or not he/she would go further for uploading.

Above code works fine and displays a perfect image with IE browser. But, it does not work with Firefox.

[/QUOTE]

Your code works locally on FireFox but not from a remote server. I think you'll find that FireFox won't load any local image into a remotely served document.
Copy linkTweet thisAlerts:
@jcckingauthorOct 20.2007 — Yep, the code is for users to view their photos locally before uploading to remote servers. So, the purpose of this code is only to view local photo files for upload decisions.

If Firefox won't load any local image into a remotely served document, it's really a pity. But, is there any security reason of doing so? If not, I think Firefox should try to improve its support status.

By the way, is there any workaround to resove this problem?

One of ideas out of the blue is to activate an IE browser window for displaying local image! (because every Windows OS has IE)

Something like: if it is a Firefox navigator, redirect and jump to open an IE browser!!??

Is it a feasible approach?
×

Success!

Help @jccking spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.18,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...