0

I am implementing a popup with javascript which fire when the page is closed . I am using the unload() page handler. The problem is that the popup does not stays ... it popups for a while but then the new page loads.

I want it to stay there until user presses cancel..

Thanks

3
Contributors
6
Replies
7
Views
7 Years
Discussion Span
Last Post by almostbob
0

Give me some code please. I don't think it dissapeares like that. I implemented once something like that and it worked well for me. Some code should help me help you :).

0

you actually want your site blacklisted
you want to open a window to override user actions
Not a particularly good idea

0

actually it is not a window it is an iframe pop up.. like saying GoodBye to user...
Actually i am firing a function to show a MOOdle popup.
Here is the code.
I donot know whats wrong with it..

It starts to appear and then vanishes.

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

<script type="text/javascript" src="javascript/moodalbox121compressed/js/mootools.js"></script>
<script type="text/javascript" src="javascript/moodalbox.js"></script>
<script type="text/javascript" src="javascript/modalbox.js"></script>
<link href="javascript/moodalbox.css" rel="stylesheet" type="text/css" media="screen">
<script type="text/javascript">
window.onbeforeunload = popup;
function popup(){
MOOdalBox.open( "popup.htm","Some kind of caption", "450 305" )
}</script>

</head>
<body>

Edited by darktangent: n/a

0

Well, it's all about how that moodle dialog works. I was talking about unload event on <body> and use of an alert() message. Try using window.stop() function from javascript (to stop the browser) and after you press OK or close the dialog use window.location.href="new_location" to redirect the browser. I can be wrong.. stop doesn't always work on all browsers... but I try to help somehow :).

1

the window.stop also does not works...
The popup loads but there is just a flash and then it vanishes...
I want it to load completely.

0

why an external file
could you use unload to change the visibility of a layer in the page's css without the extra time needed to download the file

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.