Jump to content

How do you disable the close (x) on a window


veedub

Recommended Posts

Hello!!

 

I'm running a PHP script on page1.php that takes a few seconds, once it has run the page then redirects to page2.php automatically sending variables . However, if the user shuts page1.php by pressing the X on the top right of the screen, the redirect doesn't happen!! Does anyone know how to disable the X and stop the page being closed down please?? or another solution??

 

Cheers!

James

Link to comment
Share on other sites

ok cheers, is there a way to make the window really small before the php script runs in the page? when I use the resize function:

<script>

window.resizeTo(width, height);

</script>

 

 

it runs after the PHP script, which is no use.

Link to comment
Share on other sites

There isn't a way to disable a feature of a desktop application via a web script. You can run a javascript window.close check and try to confirm that they really want to exit, but I believe this will only work in IE anyway.

Link to comment
Share on other sites

ok cheers, is there a way to make the window really small before the php script runs in the page? when I use the resize function:

<script>

window.resizeTo(width, height);

</script>

 

 

it runs after the PHP script, which is no use.

 

Javascript is a client run language, so it doesn't even load until the server script has completely finished parsing and has begun outputting data to the browser. What you would have to do is have your first page be only your javascript resize and then forward it on to the script pages where your PHP would run.

Link to comment
Share on other sites

to give you an answer to your point before Obsidian made his post

 

PHP is parsed and run on the server before your client machine ever sees any information, therefore having a javascript function on your clients machine will ALWAYS run after the php script has finished - hope that helps

 

EDIT: thanks OBS, both at the same time, you got there first

Link to comment
Share on other sites

You CAN use Javascript during a long running php script.

Set ob_implicit_flush() at the top of your page. You can then output any javascript and html and then go to processing your script. Typically I'll use a progress meter in these situations. Some other things you might try are using a pop-under to open a new window but forcing the opener to stay on top and have focus.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.