PDA

View Full Version : Resolved window.location error on firefox



davelf
11-21-2011, 09:31 AM
Hi, i have problem with window.location.
This is a weird error, i already try the page at safari, opera, chrome, ie.7 and ie.8 everything is fine.
The problem appear only on firefox.

this is the the website (http://imaxxo.net/stbaldo/)

it should be moved to the second section, when it first shows. But not in firefox, it show the first section.

Thanks in advanced

jscheuer1
11-21-2011, 04:27 PM
It doesn't appear to work in IE 9 either, not even IE 9's IE 8 or IE 7 modes. It does work in Opera. What's the exact code? What script is it in. I looked but I couldn't find it.

I looked at this a little bit more (now it is working in IE 9, guess it had to be cached?) and still couldn't find it. But it looks like if you get rid of whatever it is and instead put this as the last thing at the end of move.html (just before the closing </body> tag):


<script type="text/javascript">
jQuery(function($){
$('a[href=#section2]').eq(0).click();
});
</script>

That should do it.

The browser cache may need to be cleared and/or the page refreshed to see changes.

clueful
11-21-2011, 09:24 PM
Firebug indicates that the page is failing to load three different script files.
I'd fix that first.

"NetworkError: 404 Not Found - http://imaxxo.net/stbaldo/script/sprite/scripts/jquery-1.3.2.min.js"
jquery....min.js
"NetworkError: 404 Not Found - http://imaxxo.net/stbaldo/script/footer/foot.js"
foot.js
"NetworkError: 404 Not Found - http://imaxxo.net/stbaldo/script/footer/head.js"

jscheuer1
11-22-2011, 01:18 AM
Firebug indicates that the page is failing to load three different script files.
I'd fix that first.

"NetworkError: 404 Not Found - http://imaxxo.net/stbaldo/script/sprite/scripts/jquery-1.3.2.min.js"
jquery....min.js
"NetworkError: 404 Not Found - http://imaxxo.net/stbaldo/script/footer/foot.js"
foot.js
"NetworkError: 404 Not Found - http://imaxxo.net/stbaldo/script/footer/head.js"

Yes, but I don't think that matters here. See my previous post in this thread for the solution. But you're right, those should be fixed. Probably just have those tags removed, as the page doesn't appear to need those files.

I did finally find where the window.location thing was coming from. It's on a separate page, the hard coded source of the iframe (index-move.html):


<body onLoad="window.location.replace('move.html#section2')"; >


This would probably work in Firefox if you made it:


<body onLoad="window.location.replace('move.html#section3')"; >

But that would throw off all the others. My solution - add:


<script type="text/javascript">
jQuery(function($){
$('a[href=#section2]').eq(0).click();
});
</script>

to the end of the real target page (move.html). Put it right before the closing </body> tag. It should work. If not, do it anyway and let me check the page to see what the problem is.

The browser cache may need to be cleared and/or the page refreshed to see changes.

davelf
11-22-2011, 03:13 AM
Bad news John, there's still an error on firefox.
You can check it again at: http://www.imaxxo.net/stbaldo

(i already clear the cache & cookies too)

clueful
11-22-2011, 03:35 AM
Bad news John, there's still an error on firefox.
You can check it again at: http://www.imaxxo.net/stbaldo

(i already clear the cache & cookies too)
Of course there's an error because it's still failing to load files that aren't there, and


function init() {
disableDraggingFor(document.getElementById("draggingDisabled"));
}
Is addressing an element that doesn't exist.

If you load your iframe document directly, you'll see that the redirect works properly in Firefox.

jscheuer1
11-22-2011, 03:52 AM
Well, yes. Fix those script errors. They're not helping. But I have seen this before, Firefox not reacting to the hash as expected in an iframe. One other thing to try if after fixing those other errors doesn't take care of it, change the added script from:


<script type="text/javascript">
jQuery(function($){
$('a[href=#section2]').eq(0).click();
});
</script>

to:


<script type="text/javascript">
jQuery(window).load(function(){
jQuery('a[href=#section2]').eq(0).click();
});
</script>

And yeah, you shouldn't need that redirect, but I see how without it things get screwy in IE.

If you use just move.html as the src attribute of the iframe, fix the script error:


Error: element is null
Source File: http://www.imaxxo.net/stbaldo/move.html
Line: 46

it should be fine with just the script we just added or the window load one in this post.

But I'm still scratching my head as to why, if you make the src attribute of the iframe move.html#section2 - why in IE that seems to load a blank page into the iframe. Any idea why that's happening? #section1 and #section3 are fine in IE, just #section2 does that.

davelf
11-22-2011, 06:20 AM
Of course there's an error because it's still failing to load files that aren't there, and
Is addressing an element that doesn't exist.

If you load your iframe document directly, you'll see that the redirect works properly in Firefox.

@clueful.
Thanks for the error check, i already move that part you said it's an error.
Technically it's not, that's my id name to block all image select by user.
But it's like you said before, the iframe document read it as a critical error.
So, after i remove that part and combine it with John script everything work perfectly.

@John
Thanks John your second script work perfectly.

this is the result (http://www.imaxxo.net/s-baldo)

jscheuer1
11-26-2011, 08:12 AM
Not exactly. I notice that in Firefox, if you refresh the page it loads up the Women's panel. Not sure how or if that needs fixing.