Jump to content
xisto Community

Simple Firefox Vs. Ie Script Bug; Need A Little Help Simple script works in Firefox but not IE.

Recommended Posts

Hello I have a simple .js file that seems to work in Firefox but not IE. The error could totally be my syntax, just not sure why it's working in one browser and not the other.All I'm doing is waiting for an image to load completely before redirecting. I added an extra step that waits an additional 1.5 seconds just for 100% smooth transition (sometimes firefox reroutes before the image is actually fully loaded). This script works perfectly for Firefox, meaning if the image is already loaded/cached it reroutes immediately and if not, then waits with extra delay. In IE however, it ALWAYS waits.... for some reason the logic of checking the image "complete" is not working properly.Any ideas?---------------------------------------------

// main background imageobjImage = new Image();objImage.src='main.jpg';objImage.name='main';// if cached, then go right to home page, otherwise wait for it to load with delayif ( objImage.complete ) {    reroute();}else {    objImage.onLoad=extradelay();}function extradelay(){    window.setTimeout("reroute()", 1500);}function reroute(){    document.location.href='home.html';}


Share this post

Link to post
Share on other sites

I'm not completely sure, but I think in IE, when you define variables you have to use the 'var' keyword for some reason. Like 'var x = 0;' or something. I guess you could try that with something simple, like just displaying a string from a variable, then if it works with the 'var' keyword, and doesn't work without it, then that's probably the problem.

Share this post

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Create New...

Important Information

Terms of Use | Privacy Policy | Guidelines | We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.