Skip to content

Instantly share code, notes, and snippets.

@muratgozel
Last active March 6, 2018 10:34
Show Gist options
  • Save muratgozel/1eb7fd59b64075b80b2b9fa2364b49d4 to your computer and use it in GitHub Desktop.
Save muratgozel/1eb7fd59b64075b80b2b9fa2364b49d4 to your computer and use it in GitHub Desktop.
#!/bin/sh
# Don't forget to run "sudo chmod a+x filename" to give this script neccessary permissions in order to work properly.
osascript <<EOD
tell application "Google Chrome"
set windowList to every window
repeat with aWindow in windowList
set tabList to every tab of aWindow
repeat with atab in tabList
if (URL of atab contains "localhost") then
tell atab to reload
end if
end repeat
end repeat
end tell
EOD
#!/bin/sh
osascript <<EOD
tell application "Safari"
set windowList to every window
repeat with aWindow in windowList
set tabList to every tab of aWindow
repeat with atab in tabList
if (URL of atab contains "localhost") then
tell atab to do javascript "window.location.reload()"
end if
end repeat
end repeat
end tell
EOD
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment