cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

open window with a timeout

tisdall
Making moves

Is there a way to open a new window or tab (private or otherwise) with a timeout so that the window will be killed after some given period of time?  I'm using firefox on a mac (both current software versions)

Thanks

2 REPLIES 2

Jorjdavid639
Making moves

To open a window with a timeout using JavaScript, you can use the window.open() method along with setTimeout(). 

Here's how I ended up doing it, with this perl script:

#!/usr/bin/perl
#
#print "USAGE: windowtimeout SECONDS\n";
#
# To work if firefox is already running:
# Follow directions at https://support.mozilla.org/en-US/questions/1451592
# Profiles are created like this:
# firefox --new-instance --createprofile "PROFILENAME ~/.firefox-PROFILENAME"
# They are run like this:
# firefox --new-instance --profile "~/.firefox-PROFILENAME"

# Relies on "brew install coreutils" version of Linux timeout - "gtimeout"

my $seconds = $ARGV[0]; chomp $seconds;

exec '/opt/homebrew/bin/gtimeout ' . $seconds . ' /Applications/Firefox.app/Contents/MacOS/firefox --private-window --new-instance --profile "~/.firefox-TIMEOUT" 2>/dev/null';