Jump to content

Recommended Posts

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

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?

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.

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

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.