Safari

Safari Kiosk Tabs

An AppleScript to ensure that new Safari windows are opened in a tab

In the Watershed Café/Bar there are a number of ‘Slacker Tables’—public web browser kiosks set in glass tables. Oliver asked about a way to ensure that the instances of Safari running on the tables would open a new tab and not a new window. This is a simple AppleScript, to be saved as an Application and run, in a loop in the background.

This was only a quick, five minute hack but the results are surprisingly usable. Running the script as an application in the background doesn't appear to affect performance or stability over longer periods of time.

Note: this script has only been tested with Safari 3.2.1 in MacOS X 10.5.5

  1. repeat
  2. delay 1
  3. tell application "Safari"
  4. if the (count of documents) > 1 then
  5. set theURL to the URL of the front document
  6. if theURL is not "" then
  7. close front document
  8. tell front window
  9. -- Safari appears to only let the front window create tabs
  10. set theTab to make new tab
  11. set current tab to theTab
  12. set the URL of theTab to theURL
  13. end tell
  14. end if
  15. end if
  16. end tell
  17. end repeat
|

odds&ends…
Benjamin Miller