Skip to content

Instantly share code, notes, and snippets.

@scottlee
Last active March 7, 2024 19:25
Show Gist options
  • Save scottlee/539754825b536747dba1 to your computer and use it in GitHub Desktop.
Save scottlee/539754825b536747dba1 to your computer and use it in GitHub Desktop.
Applescript for reloading a browser in the background. Useful when paired up with an Automator application and PhpStorm external tool shortcut.
# Choose your browser:
# Chrome
# tell application "Google Chrome"
# reload active tab of (get window 1)
# end tell
#
# # Safari
# tell application "Safari"
# tell window 1
# do JavaScript "window.location.reload(true)" in current tab
# end tell
# end tell
#
# # Firefox
# # Firefox doesn't support the Apple do JavaScript call.
# tell application "Firefox"
# activate
# end tell
#
# tell application "System Events"
# tell process "Firefox"
# keystroke "r" using {command down}
# end tell
# end tell
#
# tell application "PhpStorm"
# activate
# end tell
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment