Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

browser crahses on screen resize

Status
Not open for further replies.

royyan

Programmer
Jul 18, 2001
148
US
I use following code to identify the screen resolution then redirect it to different pages accordingly.
***********************************************
<%@ language=VBScript %>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">

<html>
<head>
<title>Hartsville</title>

<script language="JavaScript">
URL = "index800.asp";

if (window.screen.width >= 1280) {
URL = "index1280.asp";
}
else {
if (window.screen.width >= 1024) {
URL = "index1024.asp";
}
}
location.href = URL;
</script>
</head>

<body>



</body>
</html>
***********************************************

On page index800.asp, index1024.asp and index1280.asp, I have javascript code to resize the window based on screen resolution. Following is code for index800.asp

<script>
<!--
onload=init;

function init() {
HWND = window.open("default.asp?screen=800","",config="left=0,top=0,height=600,width=800");

window.opener = this;
this.close();
}
//-->
</script>

These code works fine on my own machine. But crashes browser on some testing machine, especially those with "Pop Up Blocker" installed.

Can anybody tell me if there is any other way I can reach the same goal.
Thanks!
 
Why don't you just skip the index(xxx) pagaes and go with this:
Code:
<script>
<!--
window.location = "default.asp?screen="+screen.availWidth;
//-->
</script>
 
Hi Supra, based on your suggestion, on which step should I resize the window?
Thanks!
 
On your very first page. Replace this..
Code:
<%@ language=VBScript %>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">

<html>
<head>
<script language="JavaScript">
URL = "index800.asp";

if (window.screen.width >= 1280) {
  URL = "index1280.asp";
}
 else {
    if (window.screen.width >= 1024) {
      URL = "index1024.asp";
    }
}
location.href = URL;
</script>
..with the code I gave above. That way you don't have to deal with window.opener = this. Some browsers don't support that. I have a site that uses it, and popup blockers will filter it out and screw up your site.
 
I am off work right now and will try your suggestion tomorrow morning in the office to see if it work.
Thanks!
 
Hi Supra,

Just test your suggestion. The browser can resize based on screen resolution. But, looks like you by passed the another issue here. If I don't use a winder.opener, how can I apply code below so I can take the status bar out?
config="resizable,menubar,left=0,top=0,height=600,width=800"
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top