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? Link to comment https://forums.phpfreaks.com/topic/283420-keyboard-strock-action/ 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? Link to comment https://forums.phpfreaks.com/topic/283420-keyboard-strock-action/#findComment-1456131 Share on other sites More sharing options...
.josh Posted October 30, 2013 Share Posted October 30, 2013 bad. bad. baaaaaaaaaaad. shoo. Link to comment https://forums.phpfreaks.com/topic/283420-keyboard-strock-action/#findComment-1456133 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. Link to comment https://forums.phpfreaks.com/topic/283420-keyboard-strock-action/#findComment-1456136 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 Link to comment https://forums.phpfreaks.com/topic/283420-keyboard-strock-action/#findComment-1456163 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. Link to comment https://forums.phpfreaks.com/topic/283420-keyboard-strock-action/#findComment-1456185 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.