Results 1 to 2 of 2

Thread: Adding close tab after X minutes to a userscript

  1. #1


    Join Date
    Apr 2019
    Gender
    Posts
    30
    Userbars
    1
    Thanks
    45
    Thanked 4 Times in 3 Posts


    Downloads
    14
    Uploads
    0
    Mentioned
    0 Post(s)
    Time Online
    1 d 6 h 6 m
    Avg. Time Online
    3 m
    Rep Power
    2

    Adding close tab after X minutes to a userscript

    I would like to know how to add on code to a userscript that will close the tab or even just stop the script after X amount of time. It is a script that refreshes the page often, so when I tried some other suggestions I found online they did not seem to work. Could someone explain how to do this? Thanks!

  2. #2

    Join Date
    Oct 2013
    Gender
    Posts
    21
    Userbars
    0
    Thanks
    0
    Thanked 3 Times in 3 Posts


    Downloads
    6
    Uploads
    0
    Mentioned
    0 Post(s)
    Time Online
    1 d 1 h 6 m
    Avg. Time Online
    N/A
    Rep Power
    7
    Sorry. I am a bit new here so I am really not sure what language this user script is written in. Which language is it written in? Regardless, here is some more generalized advice and you can see if it is appropriate for your usage:

    1) If you are using Puppeteer (which is for JavaScript), it would be as simple as page.close(). Puppeteer is a library to control headless Chrome written by Google. It is meant for automating testing of webpages often times, but can also be used for botting.

    2) Assuming you are not using JavaScript, I would recommend some binding to Puppeteer or look for Selenium for your language. If that is not possible, then maybe you can an autohotkey. An autohotkey for closing tabs for Chrome is CTRL + W.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •