Home

Forums

Web development

 

 

 

 
     
 
dna88 Web development and Technology Forum
 
Profile   Register   Memberlist   Usergroups   FAQ   Search  Log in
Close pop up window without system warning

 
Post new topic   Reply to topic    dna88 Forum Index -> Web scripting language Discussion Forum
Author Message
quantum
Site Admin
Site Admin


Joined: 07 Mar 2004
Posts: 1048
Location: Dhaka, Bangladesh

Post Post subject: Close pop up window without system warning Reply with quote

Well, I want to close a pop up window with javascript. But as we all know if I use javascript to automatically close the window without the user clicking any button or link, with window.close() there would be a windows system message popping up saying that the windows is trying to close itself. So, is there a way around this to avoid this annoying windows warning message?
_________________

Dust fills my eyes / Clouds roll by / and I roll with them / Centuries cry / Orders fly / and I fall again
Afford best design, implement best solution. Outsource your web design.
Sun Aug 01, 04 7:50 am
Back to top
quantum View user's profile Send private message Visit poster's website AIM Address
emm
Power User
Power User


Joined: 13 Jul 2004
Posts: 310

Post Post subject: Pop up browser window Reply with quote

As far as I know this is not possible to do with a browser. Bcause it could be potentially a security hazard. I don't know but active-x might have some similar feature. I doubt that too. You may have to be content with the user having to close the window by clicking the close button. I can't think what you are trying to do but this might come in handy. Amazing Draggable Layer Use, instead of popup windows

[http://codelifter.com/main/javascript/dragablelayer.html]

Looks very cool to me, instead of normal pop up message windows.

This script implements a draggable layer that
can be used much like a popup window... but with-
out the usual focus problems that popups often
imply. Also included are simple controls to show
or hide the draggable layer. Compatible with
NS4-7 & IE.
_________________
“You might say reality is the result of complex negotiations between the observer and the observed. But that is simply a point of view…”
Digital Bangladesh
Mon Aug 02, 04 3:34 am
Back to top
emm View user's profile Send private message
emm
Power User
Power User


Joined: 13 Jul 2004
Posts: 310

Post Post subject: Close pop up window without windows warning Reply with quote

Wheeeeeew I outdone myself. I found a code that would actually do what you are trying to accomplish. Close a windows without user input and without a warning too!

Try this.

Code:
<html>
<head>
<script language="Javascript">
window.open("index.html","mywindow",'scrollbars=yes,status=yes,width=300,height=300');</script>
</head>
<body>
<script>onload=window.opener=null;window.close();</script>
</body>
</html>


This code opens up a new pop up window and closes the original window. No warning or nothing. You can customize this bit of code to do what you want.
_________________
“You might say reality is the result of complex negotiations between the observer and the observed. But that is simply a point of view…”
Digital Bangladesh
Mon Aug 02, 04 3:43 am
Back to top
emm View user's profile Send private message
emm
Power User
Power User


Joined: 13 Jul 2004
Posts: 310

Post Post subject: closeing browser window with javascript Reply with quote

Surprise surprise! More info. I have not tried this but the following code should be helpful in this context too.

Code:
window.opener = null
window.close()
return false



window.opener=null is the trick code here.

Example:
<a href="#" onclick="window.opener=null; window.close(); return false">close</a>

This is for closing the window by clicking a link but you can change it and try it as onload event with a timer.
_________________
“You might say reality is the result of complex negotiations between the observer and the observed. But that is simply a point of view…”
Digital Bangladesh
Mon Aug 02, 04 4:07 am
Back to top
emm View user's profile Send private message
quantum
Site Admin
Site Admin


Joined: 07 Mar 2004
Posts: 1048
Location: Dhaka, Bangladesh

Post Post subject: Reply with quote

Hey thanks for all the trouble you have gone through. I will adopt the window.open version. It'll probably do what I need to do.

One problem though. It only works in IE not in firefox or opera. The original windows does not close for the code you provided. I guess you did not notice but this code does execatly what you are saying in the 3rd post. Uses window.opener=null . Thanks for the great pointer. I still have to make a timer. Gentle smile
_________________

Dust fills my eyes / Clouds roll by / and I roll with them / Centuries cry / Orders fly / and I fall again
Afford best design, implement best solution. Outsource your web design.
Mon Aug 02, 04 7:15 am
Back to top
quantum View user's profile Send private message Visit poster's website AIM Address
emm
Power User
Power User


Joined: 13 Jul 2004
Posts: 310

Post Post subject: Reply with quote

I am sorry that I did'nt notice it was using the same javascript technique. Got too excited I suppose. Anyway, as long as it works for you my effort is well paid.
_________________
“You might say reality is the result of complex negotiations between the observer and the observed. But that is simply a point of view…”
Digital Bangladesh
Tue Aug 03, 04 2:23 am
Back to top
emm View user's profile Send private message
hasnut
Expert User
Expert User


Joined: 28 Aug 2004
Posts: 201

Post Post subject: Reply with quote

Warning! popup window lovers.

Who have sites that uses popup windows, have a bad news.

In Windows XP SP2 , its blocked

without user reaction window.open or window.createPopup will not work.

here is the info from microsoft
[http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnwxp/html/xpsp2web.asp]
Sat Aug 28, 04 4:40 pm
Back to top
hasnut View user's profile Send private message Visit poster's website MSN Messenger
quantum
Site Admin
Site Admin


Joined: 07 Mar 2004
Posts: 1048
Location: Dhaka, Bangladesh

Post Post subject: Pop up window blocker Reply with quote

That's a good news!

But in fact, I suspect the update is sufficiently buggy (as with any and all micosoft product). I have used XP sp2 and the popup blocker does not work most of the time. I regularly get pop up warnings with my webmail and also in this forum when a new private message arrives. I have not turned off the pop up blocker manually either.

For those who are looking for an effective pop up blocker, Google Toolbar does the job most effectively.
_________________

Dust fills my eyes / Clouds roll by / and I roll with them / Centuries cry / Orders fly / and I fall again
Afford best design, implement best solution. Outsource your web design.
Sat Aug 28, 04 6:17 pm
Back to top
quantum View user's profile Send private message Visit poster's website AIM Address
emm
Power User
Power User


Joined: 13 Jul 2004
Posts: 310

Post Post subject: Close microsoft pop up Reply with quote

That article says about windows.open function. But I tested my code on IE 6 with xp service pack 2 and it did close the popup without a system warning. Maybe, it is just another microsoft pop up or something.
_________________
“You might say reality is the result of complex negotiations between the observer and the observed. But that is simply a point of view…”
Digital Bangladesh
Sat Aug 28, 04 10:32 pm
Back to top
emm View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    dna88 Forum Index -> Web scripting language Discussion Forum All times are GMT - 7 Hours
Page 1 of 1

 

Partners and Resources

Bangladesh hosting company

Bangladesh web design

Driven by phpBB © phpBB Group