dumbASP
asked on
Open New Window and close Previous window
I'm looking for a script that will automatically open a new window when the page is loaded and will close the initial window. The new window will need to have a height of 450 and width of 95%. I will also need the option to choose whether or not to show browser elements.
Any suggestions?
ASKER
The open in new window portion works great .. thanks...
However... the close window portion is not working. It is simply leaving a blank window open on the screen.
window.close();
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Don't know your exact situation, why don't you just resize the current window instead of launching a new one and then closing the old one????
window.resizeTo(400,300)
window.location.href='blah blahblah.h tm'
Brett
window.resizeTo(400,300)
window.location.href='blah
Brett
i would also go with resizing... because the user gets asked, if he really allows you to close the parent window...
to avoid this, just resize the win...
ASPGuru
to avoid this, just resize the win...
ASPGuru
ASPGuru,
>>> i would also go with resizing. <<<
Resizing avoids the close window dialog, but does not allow you to remove the browser menus/bars. Sometimes you want to present a clean window without all the browser menus/bars/etc. I often do this in apps where I have a main page that spawns "sub-windows". It looks more professional -- almost like a windows app. <bg>
Best Regards,
>apollois<
>>> i would also go with resizing. <<<
Resizing avoids the close window dialog, but does not allow you to remove the browser menus/bars. Sometimes you want to present a clean window without all the browser menus/bars/etc. I often do this in apps where I have a main page that spawns "sub-windows". It looks more professional -- almost like a windows app. <bg>
Best Regards,
>apollois<
yea sure... everything has benefits and drawbacks...
dumbASP needs to decide...
ASPGuru
dumbASP needs to decide...
ASPGuru
i'm not getting any warnings on window.close();..
is it because windows.close() executed from within a child pop-up window?
is it because windows.close() executed from within a child pop-up window?
DRY_GIN,
>>> i'm not getting any warnings on window.close();.. <<<
If you create the window, you can close it without warning.
Best Regards,
>apollois<
>>> i'm not getting any warnings on window.close();.. <<<
If you create the window, you can close it without warning.
Best Regards,
>apollois<
No comment has been added lately, so it's time to clean up this TA.
I will leave a recommendation in the Cleanup topic area that this question is:
Accept Answer by apollois
Please leave any comments here within the next seven days.
PLEASE DO NOT ACCEPT THIS COMMENT AS AN ANSWER!
GaryC123
EE Cleanup Volunteer
I will leave a recommendation in the Cleanup topic area that this question is:
Accept Answer by apollois
Please leave any comments here within the next seven days.
PLEASE DO NOT ACCEPT THIS COMMENT AS AN ANSWER!
GaryC123
EE Cleanup Volunteer
Use the BODY onLoad event to call a custom Javascript function. Let me know if you have any questions.
==========================
<HTML>
<HEAD>
<script LANGUAGE="javascript">
<!--
//------------------------
function DisplayWindow(pcURL) {
//------------------------
var popup;
var intWidth = 518;
var intHeight = 700;
var intTop = 0;
var intLeft = 400;
var strFeatures = 'toolbar=0,scrollbars=1,lo
+ 'statusbar=0,menubar=0,res
+ 'width='+intWidth+',height
popup = window.open(pcURL, "HealthPlan", strFeatures);
//Close Original Window -- this will cause a confirmation dialog box
//to be displayed to the user. You cannot avoid this.
window.close
}
//-->
</script>
</HEAD>
<BODY onLoad="DisplayWindow('New
</BODY>
</HTML>
==========================
Best Regards,
>apollois<