By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
459,461 Members | 1,120 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 459,461 IT Pros & Developers. It's quick & easy.

JavaScript image loading problem in Firefox

P: n/a
Firefox seems to be restricting JavaScript image loading. The following
code works fine in all browsers except Firefox:

function loadImage()
{
var objIcon = document.createElement( 'IMG' );
objIcon.src = "/techJournal/firefoxIcon.png";
document.body.appendChild( objIcon );
}

The image simply doesn't load, as you will see at:
http://www.firethefox.co.uk/techJour...avaScript.html

Could it be that the security lockdowns in the latest version of
Firefox prevent image loading in JavaScript? If so, does anyone know a
workaround that I can introduce into my code?

I'd be grateful for your help

Chris Beach

Dec 19 '05 #1
Share this Question
Share on Google+
7 Replies


P: n/a
ch***@chrisbeach.co.uk wrote in news:1135005379.885527.267190
@g43g2000cwa.googlegroups.com:

The image simply doesn't load, as you will see at:
http://www.firethefox.co.uk/techJour...avaScript.html


does this mean you fixed it? works fine in FF1.5 for me.
Dec 19 '05 #2

P: n/a
Nope, unfortunately not. Maybe this only fails with certain
environments?

Dec 19 '05 #3

P: n/a
Images are enabled in my browser, and the problem occurs whether or not
the "for the originating site only" option is ticked.

Any more ideas, anyone?

Dec 19 '05 #4

P: n/a
Yes, JavaScript is enabled, and there are no messages in the JavaScript
console.

Dec 19 '05 #5

P: n/a
ch***@chrisbeach.co.uk wrote:
Firefox seems to be restricting JavaScript image loading. The following
code works fine in all browsers except Firefox:

function loadImage()
{
var objIcon = document.createElement( 'IMG' );
objIcon.src = "/techJournal/firefoxIcon.png";
document.body.appendChild( objIcon );
}
<URL:http://PointedEars.de/scripts/test/whatami#inference>
The image simply doesn't load, as you will see at:
http://www.firethefox.co.uk/techJour...avaScript.html
WFM. Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.8) Gecko/20051217
Debian/1.5.dfsg-2 Firefox/1.5 Mnenhy/0.7.3.0
Could it be that the security lockdowns in the latest version of
Firefox prevent image loading in JavaScript?
Check Edit, Preferences, Content, Load Images.
Try Ctrl+Shift+r. Clear the cache (directory).
If so, does anyone know a workaround that I can introduce into my code?


Fortunately for other users, there is none.
PointedEars
Dec 19 '05 #6

P: n/a
My UA is Mozilla/5.0 (Windows; U; Windows NT 5.1; en-GB; rv:1.8)
Gecko/20051111 Firefox/1.5

I have tried the steps you pointed out but to no avail

My employer puts restrictions and enforced configuration on certain
software. It could be that these apply to Firefox and are causing the
problem I'm seeing. Thanks for looking into this, guys. I guess the
issue isn't widespread so I probably shouldn't be worried about it.

Dec 20 '05 #7

P: n/a
The problem has been identified by Ben Basson, who commented on my
blog:

Having the pref "dom.disable_image_src_set" set as the boolean value
'true' in about:config will cause your script to fail.

IIRC, this option was removed from the interface because there's no
logical reason that anyone would want to disable this behaviour. It's
default value is set to 'false', i.e. changing the src of an image is
allowed by default.

I can't think of a workaround, but I sort of hope that there isn't one,
since that would somewhat devalue the preference.

Dec 22 '05 #8

This discussion thread is closed

Replies have been disabled for this discussion.