473,394 Members | 1,932 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,394 software developers and data experts.

JavaScript image loading problem in Firefox

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
7 7647
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
Nope, unfortunately not. Maybe this only fails with certain
environments?

Dec 19 '05 #3
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
Yes, JavaScript is enabled, and there are no messages in the JavaScript
console.

Dec 19 '05 #5
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
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
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
by: joaopedrogoncalves | last post by:
Hi, I want to load an external javascript file, get its results and stick them inside a <div> block. I also want to do this in several places on a web page. This way the browser doesn't have...
4
by: zborisau | last post by:
Hey good people, I've been given a problem to solve recently - and stuck with the solution for a good 4 days already. i have a link which leads to popup window. the purpose of that popup...
3
by: willwade | last post by:
Hi there, Sorry for the perhaps undirected post - Ive struggled for the past few hours and cant see the wood for the trees.. I have a page (infact a site but I will keep it simple) that is a...
3
by: jblossom | last post by:
Hello, I'm in a quandary as to how to address a problem. The site in question: http://agapeyoga.com On the left-hand side of the site are image navigation elements that change when clicked...
8
by: chrisdude911 | last post by:
how do i add video into a javascript web page with my own custom buttons?
3
by: Joe Cox | last post by:
I am having a problem with style properties for dynamic images in Mac OS X Safari. By dymanic images, I mean images allocated with the javascript 'new Image()' call. With static images (created...
1
by: ozzy.osborn | last post by:
Hello All, I have been struggling with a cross browser solution to loading external javascript files on the fly. I have been successful using the following code in IE6: var newScr =...
12
by: tim | last post by:
I am using foldoutmenu 3 and am having problems with viewing my menus in firefox. On my sub3 menus i have more than one line of text in some places. firefox does not recognise that there is more...
2
by: OBAFGKM_RNS | last post by:
Let's say I have a Javascript function that loops over and over. In that function i have it alternating images on a button this way: if(var==0){ var myHTML = "<input type='button'...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
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...

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.