Jump to content

Can this be done


stuckwithcode

Recommended Posts

Server-side language. So no (BUT yes) I'd like to say, but using something like a client side language to start a php program maybe. But beyond the scope of strictly php for every time a user leaves a web page. If you require them to do something like click a link or a button then u can run the script in that sense for saying log out or whatever, but php always need somethin from the client side to tell something on the server to run. So look into javascript perhaps to force a php script on the server to run if you wanting to run a tracker for example.

 

Also don't ask can but how with a better subject, will get more responses.  Now with that said, what exactly are you wanting to do?

Link to comment
https://forums.phpfreaks.com/topic/190784-can-this-be-done/#findComment-1006042
Share on other sites

Hello,

 

When a user leaves my web page I would like to run some php code, is this possible.

 

Any suggestions are appreciated

 

The simple answer is No. PHP is a server side language, JS (On some browsers, not all to warn you) There is a JS event on abort, but this cannot be done in PHP. As mentioned by previous poster, I would not recommend setting up an automated session check, the logic is flawed.

 

You can use AJAX event along with the onAbort (or whatever it is), but this isn't the place to ask.

Link to comment
https://forums.phpfreaks.com/topic/190784-can-this-be-done/#findComment-1006043
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.