Return to Snippet

Revision: 38020
at October 20, 2011 02:38 by iloveitaly


Updated Code
osascript >/dev/null <<EOL
tell application "Safari"
	do JavaScript "if(window.location.hostname.indexOf('.local') != -1 || window.location.hostname.indexOf('.dev') || window.location.href.indexOf('file://') != -1) { window.location.reload(); }" in first document
end tell
EOL

osascript > /dev/null <<'APPLESCRIPT'
tell application "System Events"
	set isVisible to visible of process "Google Chrome"
end tell

tell application "Google Chrome"
	if isVisible then
		tell active tab of first window
			execute javascript "window.location.reload()"
		end tell
	end if
end tell
APPLESCRIPT

exit 0

Revision: 38019
at September 10, 2011 00:22 by iloveitaly


Updated Code
osascript >/dev/null <<EOL
tell application "Safari"
	do JavaScript "if(window.location.hostname.indexOf('.local') != -1) { window.location.reload(); }" in first document
end tell
EOL

osascript > /dev/null <<'APPLESCRIPT'
tell application "System Events"
	set isVisible to visible of process "Google Chrome"
end tell

tell application "Google Chrome"
	if isVisible then
		tell active tab of first window
			execute javascript "window.location.reload()"
		end tell
	end if
end tell
APPLESCRIPT

exit 0

Revision: 38018
at July 13, 2011 23:25 by iloveitaly


Updated Code
osascript > /dev/null <<EOL
tell application "Safari"
	do JavaScript "window.location.reload();" in first document
end tell
EOL

osascript > /dev/null <<'APPLESCRIPT'
tell application "System Events"
	set isVisible to visible of process "Google Chrome"
end tell

tell application "Google Chrome"
	if isVisible then
		tell active tab of first window
			execute javascript "window.location.reload()"
		end tell
	end if
end tell
APPLESCRIPT

exit 0

Revision: 38017
at December 22, 2010 14:07 by iloveitaly


Initial Code
osascript <<EOL
tell application "Safari"
	do JavaScript "window.location.reload();" in first document
end tell
EOL

osascript <<'APPLESCRIPT'
tell application "Google Chrome"
	tell active tab of first window
		execute javascript "window.location.reload()"
	end tell
end tell
APPLESCRIPT

Initial URL


Initial Description
refreshes Chrome + Safari without bringing them into focus. If Chrome is hidden, then no refresh occurs.

Initial Title
Custom TextMate Refresh Browsers Script

Initial Tags
browser

Initial Language
Bash