PDA

View Full Version : Open page in same window, or close first window without alert



JS Novice
12-16-2004, 08:04 PM
I posted this problem originally at december, 16th, but haven't received any answers. Is it really possible that there isn't any solution, or that nobody knows the solution?? :( Well, I try one more shot, pleaze post me an answer if you can help me!

I use the following code to open a new page, or more precisely, a frameset of several pages, in full screen mode:

<script>
function fullwin(targeturl) {
window.open(targeturl,"","fullscreen,scrollbars")
}
</script>

<form>
<input type="button" onClick="fullwin('mypage.html')" value="Show My Frameset">
</form>

(My last problem was related to the same script :cool: , I needed a code to make users able to close this fullscreen window.)

Problem 1
This script opens a new window when button is pushed. When the full screen window is closed down, this page with the button is still on the screen. I want the new page to load in the same window, that is, replacing the contents in the window, like target="_top"

Q1: Can somebody out there see how I can modify or rewrite the code so that the new page loads in the same window? :confused:

Problem 2
I've modifed the latter part to the following:

<form>
<input type="button" onClick="window.close(); fullwin('mypage.html')" value="Show My Frameset">
</form>

The above code closes the initial window before the new pages were loaded into a new window in full screen mode, BUT, the browser is showing an alert; "The page you are viewing are trying to close the window. Are you sure you want to close the window (Yes/No)". (Or something like that :-/ )

Q2: Do somebody out there know how to close the first window, whitout showing any alert? The first window should close while the new one was loading, whitout asking the user anything! :o

If someone is able to help me with one of these questions, my problem is solved. I would appriciate it an be very greatful!!! If you know the answer of either Q1 or Q2, or both, please post me an answer! :-)

fuzzzerd
02-14-2005, 09:17 PM
To load a page in the same window, try using

window.navigate("default.asp");

vinod_yadav1919
02-20-2005, 09:09 AM
Hi JS Novice!!!

Offcourse you can do this
try this link
http://vadivel.blogspot.com/2004/02/closing-parent-window.html