...

View Full Version : window.location.href fails in Firefox



cazador4
06-05-2007, 11:47 PM
this page in firefox get me a blank page.
please help me!


<html>
<head>
<link rel="shortcut icon" href="icono.ico">
<script language="JavaScript1.2">
function ScreenGoToURL(Big,Medium)
{
var screen_height = screen.height;
var screen_width = screen.width;
var buffer = (document.all || document.layers ||documentGetElementByID) ? 30 : 48;
if (screen_height >= 768)
{
screen_width = 1024;
screen_height = 768;
var window_width = 1024-12;
var window_height = 768-buffer;
var window_top = 0;
var window_left = 0;
window.location.href(Big);
//window.open(Big,'','resizable=no,status=yes,width= ' + window_width + ',height=' + window_height + ',top=' + window_top + ',left=' + window_left + '');
}
else
{
screen_width = 800;
screen_height = 600;
var window_width = 800-12;
var window_height = 600-buffer;
var window_top = 0;
var window_left = 0;
window.location.href(Medium);
//window.open(Medium,'','resizable=no,status=yes,wid th=' + window_width + ',height=' + window_height + ',top=' + window_top + ',left=' + window_left + '');
}
}
</script>
</head>
<body onload="ScreenGoToURL('index_1024x768.html','index_800x600.html')">
</body>
</html>

rwedge
06-06-2007, 12:15 AM
Try:
window.location.href=Big;
window.location.href=Medium;

cazador4
06-06-2007, 01:38 AM
nothing...

in IE the page go!
the problem is on the firefox.

any idea?

_Aerospace_Eng_
06-06-2007, 03:39 AM
The problem isn't firefox. Its your poorly written code. This is wrong

documentGetElementByID
It should be

document.getElementById
You really shouldn't use javascript to give a user a page based on their resolution. Not everyone maximizes their browser window and not everyone has javascript enabled. I don't. If you taught yourself to code the proper way you wouldn't need javascript to redirect the user to a certain page. You would be able to make your layout resize accordingly to any resolution.

cazador4
06-06-2007, 04:57 AM
thank u 4 all!
you solved my problem!

cazador4
06-06-2007, 06:54 PM
on mac the page don't work.
anyone know why?



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum