Results 1 to 2 of 2

Thread: Adding close tab after X minutes to a userscript

  1. #1

    Joined
    Apr 2019
    Posts
    31
    Userbars
    0
    Thanks
    46
    Thanked
    5/3
    DL/UL
    14/0
    Mentioned
    Never
    Time Online
    1d 13h 11m
    Avg. Time Online
    1m

    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
    Zer0's Avatar
    Joined
    Oct 2013
    Posts
    79
    Userbars
    2
    Thanks
    18
    Thanked
    115/37
    DL/UL
    13/0
    Mentioned
    2 times
    Time Online
    4d 10h 15m
    Avg. Time Online
    1m
    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
  •