HTML/Javascript enforcing time limit on webpage.
September 8, 2005 8:24 AM
Subscribe
HTML/Javascript enforcing time limit on webpage.
I need to enforce a time limit on how long a webpage can be viewed. The time is to be displayed prominently (i.e.) not in the status bar and also be visible at all times, whether or not the page has been scrolled down, maybe somehow fixed in one corner or another.
The time format should be minutes and seconds and ideally would count up or down. I know very little about browsers other than IE and would appreciate known implications for particular browsers of suggested solutions. It would also be good to know how tamper proof the timer would/would not be. I have found plenty of javascripts that will give me a count down for the status bar, but I would like something more visible without using an applet or anything that might cause a delay in loading the page.
I hope this question doesnt seem too lazy. I dont have the expertise or knowledge of cross browser compatability or javascript/alternatives and have not been able to find a suitable solutions. Thanks in advance.
posted by kenaman to computers & internet (17 comments total)
You can certainly do this in Javascript, by using window.setTimeout() and location.replace().
Displaying a countdown timer can be easily done using window.setInterval() combined with simple DHTML to change the display.
This is, however, no way to make it tamper-proof without using an applet or ActiveX control. Once it's been downloaded to the user's computer, which it has to be for them to see it at all, you've lost most control over it. All the user need do is disable Javascript in their browser, and that page will stay there as long as they want it to. They can also view the source and copy it to a new file, or save the page using their browser. You can't stop them from doing these things, and it's pointless to try.
posted by cerebus19 at 8:39 AM on September 8, 2005