l3rodey Posted October 30, 2013 Share Posted October 30, 2013 Hi, I am working on a exit intent software which monitors mouse movement and closes opens a popup upon exit of <html>. The problem is and I do myself and I know a lot of others do is keyboard short cuts. Is there any PHP which monitors keyboard input and can just sort of prevent closure by disabling the keyboard combination? Secondly PHP timer, is there a way of creating a php timer after 30 seconds everything within starts? like when a page is loaded the timer counts upwards when it hits 30 then everything inside { } will run? I don't want my software to be spammy. I want it to be professional tool. So I only want it to display if a user has been on the site for longer then say 30 seconds. Any Ideas? Quote Link to comment Share on other sites More sharing options...
requinix Posted October 30, 2013 Share Posted October 30, 2013 Is there any PHP which monitors keyboard input and can just sort of prevent closure by disabling the keyboard combination?No, PHP can't do it because PHP runs on the server. It would have to be Javascript. Which can't do it either so still no. Secondly PHP timer, is there a way of creating a php timer after 30 seconds everything within starts? like when a page is loaded the timer counts upwards when it hits 30 then everything inside { } will run? I don't want my software to be spammy. I want it to be professional tool. So I only want it to display if a user has been on the site for longer then say 30 seconds. You probably mean Javascript for the same reasons as above, except this time the answer is yes. What do you want to do? Quote Link to comment Share on other sites More sharing options...
.josh Posted October 30, 2013 Share Posted October 30, 2013 bad. bad. baaaaaaaaaaad. shoo. Quote Link to comment Share on other sites More sharing options...
digibucc Posted October 30, 2013 Share Posted October 30, 2013 As said, no. to the second question, it's easily done however, think hard about how you want the site to come across. any popup whether immediate or delayed is spammy, and delaying it only creates confusion ("what did i do to cause that?..."). If you still decide you want to do it just throw the delayed code at the end of the script and put sleep() before it. Quote Link to comment Share on other sites More sharing options...
JonnoTheDev Posted October 30, 2013 Share Posted October 30, 2013 Javascript can detect keyboard input. You can register an event handler i.e document.addEventListener('keydown', function(event) { if (event.keyCode == 69) { alert('you pressed the letter e'); } }, true); Here are the keycodes http://www.cambiaresearch.com/articles/15/javascript-char-codes-key-codes Quote Link to comment Share on other sites More sharing options...
digibucc Posted October 30, 2013 Share Posted October 30, 2013 thank you neil, i did not know that. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.