1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Timer that refreshes when a specific web page reloads?

Discussion in 'HTML, Graphics & Programming' started by willhub, Apr 21, 2017 at 9:19 AM.

  1. willhub

    Capodecina

    Joined: Jan 3, 2006

    Posts: 18,635

    Location: Selby/Manchester

    Hi.

    I'm wondering if this can be done, there may be restrictions it's for my work pc, basically, I want to make sure I'm completing an allocation every 2 minutes, and when I load the next one, the timer resets, is there an add-on for Chrome to do this?

    It's just a little way that may help me keep productive.



    Cheers!
     
  2. touch

    Sgarrista

    Joined: Oct 28, 2006

    Posts: 9,706

    Location: Sufferlandria

    You could do it with the TamperMonkey extension and add the following snippet of code to the page:

    setTimeout(function(){window.location.reload(); }, 120000);

    That would refresh the current page every 2 minutes (and resets if you reload the page)
     
  3. willhub

    Capodecina

    Joined: Jan 3, 2006

    Posts: 18,635

    Location: Selby/Manchester

    I'd rather not force the page to reload though, so rather, have it run down from 2 minutes, and not start until I refresh the page, as if it refreshed I'd loose my work.
     
  4. AHarvey

    Sgarrista

    Joined: Mar 6, 2008

    Posts: 7,780

    Location: Stoke area

    it depends on how you are submitting the work I suppose.

    You could add the code to a button to reset the timer when it's submitted.

    Another option would be to just have a timer running and click reset each time you submit.
     
  5. touch

    Sgarrista

    Joined: Oct 28, 2006

    Posts: 9,706

    Location: Sufferlandria

    You could change the code to give you a warning after 2 mins:

    setTimeout(function(){alert("page has been open for 2 mins"); }, 120000);

    This only works if the page reloads when you submit something otherwise it'll be more complicated and you'll need to check for button presses like AHarvey says.
     


Share This Page