Skip to content

Instantly share code, notes, and snippets.

@Zettt
Created October 27, 2013 17:11
Show Gist options
  • Save Zettt/7185129 to your computer and use it in GitHub Desktop.
Save Zettt/7185129 to your computer and use it in GitHub Desktop.
Script that uses frontmost tab and opens its Google Cache page. Wrote this while http://www.bishopfox.com/blog/2013/10/linkedin-intro/ was down.
set googleCacheURL to "http://webcache.googleusercontent.com/search?q=cache:"
tell application "Safari"
-- get url of frontmost tab
set safariWindow to first window
set originalURL to (URL of current tab of safariWindow) as text
--log originalURL
end tell
-- remove http:// or https://
if originalURL starts with "http://" then
set cacheURL to characters 8 thru (length of originalURL) of originalURL as text
else if originalURL starts with "https://" then
set cacheURL to characters 9 thru (length of originalURL) of originalURL as text
end if
--log cacheURL
open location googleCacheURL & cacheURL
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment