andz Posted November 7, 2007 Share Posted November 7, 2007 I need a code that will check the time the user spends on the webpage. and once the user is more than 1 minute, a new window will popup with the login form or if not registered form. Thanks Link to comment https://forums.phpfreaks.com/topic/76366-solved-need-code-that-will-check-the-time-the-user-spends-on-the-webpage/ Share on other sites More sharing options...
Mr P!nk Posted November 7, 2007 Share Posted November 7, 2007 Place the following script between the <HEAD> and </HEAD> tags: <script language="javascript"> <!-- begin function TimedPop() { url = "URL/to/popup.html"; width = 320; // width of window in pixels height = 390; // height of window in pixels delay = 60; // time in seconds before popup opens timer = setTimeout("popup(url, width, height)", delay*1000); } // end --> </script> Add the following code into your <BODY> tag: onLoad="TimedPop()" Your <BODY> tag should then look something like this: <BODY onload="TimedPop()" bgcolor="#ffffff" text"#000000"> this was found in a matter of seconds using google search,http://www.nowsell.com/pop-ups/pop-up-scripts.html hope it helps Link to comment https://forums.phpfreaks.com/topic/76366-solved-need-code-that-will-check-the-time-the-user-spends-on-the-webpage/#findComment-386639 Share on other sites More sharing options...
andz Posted November 7, 2007 Author Share Posted November 7, 2007 thanks for the help. i've got an error and no popup window appeared. Link to comment https://forums.phpfreaks.com/topic/76366-solved-need-code-that-will-check-the-time-the-user-spends-on-the-webpage/#findComment-386651 Share on other sites More sharing options...
Mr P!nk Posted November 7, 2007 Share Posted November 7, 2007 could you post some code and the error your being shown please =] also use tags makes life a little simpler Cheers Link to comment https://forums.phpfreaks.com/topic/76366-solved-need-code-that-will-check-the-time-the-user-spends-on-the-webpage/#findComment-386653 Share on other sites More sharing options...
andz Posted November 7, 2007 Author Share Posted November 7, 2007 no error code is being produced. but no popup is happening. i tried even in mozilla firefox and nothing's happening. Link to comment https://forums.phpfreaks.com/topic/76366-solved-need-code-that-will-check-the-time-the-user-spends-on-the-webpage/#findComment-386654 Share on other sites More sharing options...
Mr P!nk Posted November 7, 2007 Share Posted November 7, 2007 i just tried this and it worked for me <script language="javascript"> <!-- begin function TimedPop() { url = "http://yoursite.co.uk/popup/wherever.html"; width = 320; // width of window in pixels height = 390; // height of window in pixels delay = 5; // time in seconds before popup opens timer = setTimeout("window.open(url, width, height)", delay*1000); } // end --> </script> </head> <BODY onload="TimedPop()" bgcolor="#ffffff" text"#000000"> some text or other </body> Link to comment https://forums.phpfreaks.com/topic/76366-solved-need-code-that-will-check-the-time-the-user-spends-on-the-webpage/#findComment-386667 Share on other sites More sharing options...
andz Posted November 7, 2007 Author Share Posted November 7, 2007 is there a way that this script will only work if the user is not login? so if the user is already logged in, this script will not be activated, if the user is not login, the popup script will activate. Link to comment https://forums.phpfreaks.com/topic/76366-solved-need-code-that-will-check-the-time-the-user-spends-on-the-webpage/#findComment-386694 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.