 |
| Javascript General Javascript discussions. |
Welcome to the p2p.wrox.com Forums.
You are currently viewing the Javascript section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
|
|
|
|

September 4th, 2004, 12:46 AM
|
|
Friend of Wrox
|
|
Join Date: Jun 2004
Posts: 331
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
Avoid Warning Message on C lose Windows
I have a web page and I want to display it on full screen. And for this I made an other page which open the first page on full screen. But I want to close the first page without any warning. Here is the code of that page
<script language="JavaScript">
var subdirectory = "";
function show_window()
{
top.window.open("Default.htm","","fullscreen,scrol lbars")
clos()
}
function clos()
{
top.window.close()
}
</script>
</head>
<body onLoad="javascript :show_window()">
when this page is executed it dipalay the warning that this page is going to close Yes or NO
I want to avoid this message and close this window with out any warning
(*_*)
:D
Numan
--------------------------------------------------
Love is the most precious thing of this world. So find and grab it! 
__________________
(*_*)
Numan
--------------------------------------------------
It is not important what you get But important is how you got it
|
|

September 4th, 2004, 02:20 PM
|
|
Friend of Wrox
|
|
Join Date: Nov 2003
Posts: 1,285
Thanks: 0
Thanked 2 Times in 2 Posts
|
|
There is a hack for IE that gets rid of the message, but it won't work on other browsers.
Before the top.window.close() line, add this line:
top.opener = top;
HTH,
Snib
<><
|
|

September 10th, 2004, 10:53 AM
|
|
Authorized User
|
|
Join Date: Sep 2004
Posts: 10
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
why don't you just resize the window instead of closing it and openind another one?
|
|

September 10th, 2004, 11:09 AM
|
|
Friend of Wrox
|
|
Join Date: Nov 2003
Posts: 1,285
Thanks: 0
Thanked 2 Times in 2 Posts
|
|
isNaN,
By fullscreen, Numan means no toolbars, statusbar, titlebar, addressbar, etc. Removing these cannot be achieved without opening a new window, or perhaps with ActiveX (which I do not know).
HTH
Snib
<><
|
|

September 10th, 2004, 11:56 AM
|
|
Authorized User
|
|
Join Date: Sep 2004
Posts: 10
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
oh I know what you mean now. But a message will come up when trying to close a window that wasn't opened by script. I don't see why you would wan't to do that. Can't you live with the other window open if it's not focus what difference does it make.
|
|

September 10th, 2004, 01:18 PM
|
|
Friend of Wrox
|
|
Join Date: Nov 2003
Posts: 1,285
Thanks: 0
Thanked 2 Times in 2 Posts
|
|
Although I agree with you about living with the other window open, Numan asked for a way to close the window without the "this window was not opened by a script" warning, and I gave him one, at least for IE. There may be a similar hack for other browsers, but I don't know of any.
HTH
Snib
<><
|
|

September 10th, 2004, 02:00 PM
|
|
Authorized User
|
|
Join Date: Sep 2004
Posts: 10
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
Yes I know you gave a perfectly valid answer to the problem viewing on IE. I understand that he wanted to close the window. But I think it's is putting a lot of extra work in to make sure you come up with a way for every browser. When leaving the window open wouldn't make that much difference. Don't get me wrong I do get involved in site design and want to make it as perfect as possible. but I would leave out all of the if's and else if's that would be required if there are these hacks for every browser.
|
|

September 10th, 2004, 03:07 PM
|
|
Friend of Wrox
|
|
Join Date: Nov 2003
Posts: 1,285
Thanks: 0
Thanked 2 Times in 2 Posts
|
|
isNaN,
It is a good idea to avoid browser detection, but if it is the only way, sometimes it must be done. Myself, I would just leave the window open.
Anyway, I doubt there is a way to do this for every browser :-)
-Snib <><
http://www.snibworks.com/
|
|

September 11th, 2004, 01:54 AM
|
|
Friend of Wrox
|
|
Join Date: Jun 2004
Posts: 331
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
Hi Dears
Snib code is working very well in IE but as I open the full screen window then I want to make my own close and minimize button on it. And as for as the close button is concern I made it but remain problem in minimizing the window.
Any idea how to minimize the window?
Numan
--------------------------------------------------
Love is the most precious thing of this world. So find it and grab it!
|
|

September 11th, 2004, 11:19 AM
|
|
Friend of Wrox
|
|
Join Date: Nov 2003
Posts: 1,285
Thanks: 0
Thanked 2 Times in 2 Posts
|
|
AFAIK you can't with a fullscreen window. window.blur() is the next best thing.
-Snib <><
http://www.snibworks.com/
|
|
 |