I'm not certain how far back this goes, but pressing the Escape key in Safari 5.1.5 pauses animated GIFs on a web page. I have an older Mac with Safari 3.2.1 and this functionality is not present there. It would be great if there were a single command to stop these GIFs completely, but this is better than nothing.
It's possible other browsers have a similar capability, but this appears to be a Safari-specifc shortcut. Testing with iCab 4.8, a browser which uses the built-in WebKit frameworks, does not respond to the same command.
[kirkmc adds: Indeed, this does work. In Firefox, this stops the animation entirely, unlike Safari, where it only pauses the animation. In Chrome and Opera, it has no effect.]
A YouTube video can be downloaded by Option-double-clicking its video URL in Safari's Activity window. (See this hint.) However, if a lot of tabs are open, the URL can be difficult to find; particularly as now it will often have no "MB" value in the Status column.
This script will find the YouTube video URL of the current tab in the Activity window, and attempt to download it in Safari. You will need to always have at least one download in the Downloads popover to make it available! Otherwise, the script leaves the video URL highlighted for an Option-double-click download. Run the script with your favourite app launcher.
It works by first searching the Activity window for the name of the current Safari tab, then opening the disclosure triangle to find the "videoplayback" URL. Then, if its available, the "Show Downloads" button is clicked and its popover is brought into focus. Finally, the script pastes in the video URL for downloading.
There are some delays in the script that can be un-commented if you find it goes too fast for the windows on your Mac to keep up with. (The delays are not necessary on my mid-2011 MacBook Air.) Change the _videoName value if there's another kind of unique element you'd like to download instead.
A couple of incidental things I noticed about the Downloads popover: it can only be brought into focus by clicking its list first (clicking its buttons won't work otherwise), and clicking "Clear" when a file is downloading will clean up its list without removing the downloads button from Safari's toolbar.
Here's the AppleScript code:
try
set _videoName to "videoplayback"
set _downloadButtonAvailable to true
tell application "Safari" to activate
-- delay 0.5
tell application "Safari" to set _windowName to name of current tab of window 1
tell application "System Events"
tell process "Safari"
try
set _downloadButton to item 1 of (every button whose description = "Downloads") of tool bar 1 of window _windowName
on error a number b
set _downloadButtonAvailable to false
end try
tell menu item "Activity" of menu "Window" of menu bar item "Window" of menu bar 1 to click
try
window "Activity"
on error a number b
tell menu item "Activity" of menu "Window" of menu bar item "Window" of menu bar 1 to click
end try
-- delay 0.5
tell outline 1 of scroll area 1 of window "Activity"
set _count to count of rows
try
repeat with i from 1 to _count
tell group 1 of row i
try
try
set _triangleValue to value of UI element 1
if _triangleValue = 1 then
tell UI element 1 to click
-- delay 0.2
end if
tell text field 1 to set _value to value
if _value = _windowName then exit repeat
end try
value of text field 1
on error a number b
exit repeat
end try
end tell
end repeat
end try
set _count to count of rows
repeat with n from 1 to _count
try
tell group 1 of row n
tell text field 1 to set _value to value
if _value = _windowName then
set _row to n
set _triangleValue to value of UI element 1
if _triangleValue = 0 then tell UI element 1 to click
exit repeat
end if
end tell
end try
end repeat
set _count to count of rows
repeat with x from _row to _count
try
tell row x
tell text field 1 to set _value to value
if _value contains _videoName then
set _url to value of text field 1
if _downloadButtonAvailable = false then select
exit repeat
end if
end tell
end try
end repeat
end tell
try
_url
on error a number b
error "The '" & _videoName & "' URL couldn't be found."
end try
if _downloadButtonAvailable = true then tell menu item "Activity" of menu "Window" of menu bar item "Window" of menu bar 1 to click
end tell
end tell
if _downloadButtonAvailable = false then
tell application "Safari"
activate
display dialog "The 'Show Downloads' button is not available.
Option-click the selected '" & _videoName & "' URL to download the video." with title "Safari YouTube Video Downloader"
end tell
else
set the clipboard to _url
-- delay 0.5
tell application "System Events"
tell process "Safari"
try
pop over 1 of _downloadButton
on error a number b
click _downloadButton
end try
set focused of list 1 of scroll area 1 of pop over 1 of _downloadButton to true
end tell
-- delay 0.5
keystroke "v" using command down
end tell
end if
on error a number b
if a does not contain "user canceled." then tell application "Safari" to display dialog a with title "Safari YouTube Video Downloader"
end try
[kirkmc adds: I tried this with a few videos, and it works. That's some pretty impressive AppleScripting. One question: can't you make the Downloads popover visible by sending a Command-Option-L keystroke?]
It is well known that one can add a link to the reading list using the link's contextual menu. However, I have found another mouse shortcut for three-button mice. It works at least in Mac OS X 10.7.3 in Safari 5.1.2 and 5.1.3.
Click the link with the middle mouse button while holding the shift key and watch the link jump to your reading list.
[crarko adds: I don't have a three-button mouse handy to test this, but if you have a programmable mouse, you should be able to make an application-specific macro to do this too. If you try this out in 10.6, please post the results in the comments.]
This hint describes a way to change one of Safari's built-in search engines (Google/Yahoo/Bing) into a custom one, without the use of any plugins/add-ons/extensions. It involves carefully editing one of Safari's binary (much like the previous hint.)
Go to /System/Library/PrivateFrameworks/Safari.framework/Versions/A/ and save the file named 'Safari' somewhere safe. If something goes wrong while editing, it's just a matter of copying that back (tested myself).
Do the same for this file /Users/USER/Library/Safari/Configurations.plist.signed.
Open 'Configurations.plist.signed' with any text editor and erase everything in it, making it blank. Save it, and then right-click to 'Get Info,' and tick the 'Locked' box.
Now for the binary I recommend a hex editor, I used the free HexFiend.).
Open the /System/Library/PrivateFrameworks/Safari.framework/Versions/A/Safari with your tool of choice. If you search google/yahoo/bing you'll find several strings, I decided to edit the Bing one because It was the one with the least amount of strings to edit, and as my new search engine I choose DuckDuckgo.
Note that you have to replace the old string with one of the same length, otherwise Safari will crash, and since the new one is shorter, add blank spaces to the end.
It's a bit easier if using a hex editor.
I also tried editing the suggestions string to DDG's but It didn't work, Safari wouldn't display the suggestions with the new string, and since I didn't want suggestions from Bing I just blanked out the http://api.bing.com/asjson.aspx?query={searchTerms}&form=APMCS2 string.
Search for:
68 74 74 70 3A 2F 2F 61 70 69 2E 62 69 6E 67 2E 63 6F 6D 2F 61 73 6A 73 6F 6E 2E 61 73 70 78 3F 71 75 65 72 79 3D 7B 73 65 61 72 63 68 54 65 72 6D 73 7D 26 66 6F 72 6D 3D 41 50 4D 43 53 32
Save It, open Safari.app and select Bing (I wasn't able to change the search bar label, if someone finds a way, please post!), but now instead of Bing, your searches will go to DDG.
[crarko adds: I haven't tested this one. Be certain you have known good backups of any of these files that you edit, and also be aware that the next time the System or Safari is updated, there may be issues.]
The just released OS X 10.7.3 has a new Safari version but the old FDisplay Sleep Issue on HTML5 Video was still not fixed, so I started to look around for a solution and it seems that it is a WebKit Bug, and I made a workaround for this.
Go to the WebKit Project home page and download the latest Nightly Build; it has worked for me so far.
Put it into your Applications Folder and launch, and the browser launches as Safari containing all settings and features, so go to Settings and make WebKit your default browser.
Next download and install the RCDefaultApp PrefPane launch it and go under the application pane to WebKit and enable all file associations and actions.
Safari is no longer the default, now go to the Extensions Pane and search for the safariextz Extension, set it to open with WebKit as well, now you are done, Safari is still there and running if needed, but all actions are now redirected to WebKit, so you are always up to date.
[crarko adds: I haven't tested this one specifically, but many of us have used the WebKit nightly builds as a Safari replacement for a long time. RCDefaultApp is also a well-tested and proven utility, and I recommend it without hesitation.]
Ever want to change your default search engine to something other than Google, Bing or Yahoo?
I've been very frustrated with the limited search options available in Safari. In addition, I am very concerned about how much information about me leaks out to Google especially now that they are tying in google plus information and the fact that most sites I go to seems to use Google analytics.
I personally edited my /etc/hosts file pointing search.yahoo.com to 184.72.115.86 then selected Yahoo! from the search box drop-down menu. I really love the advanced features and seamless integration this provides. In addition Google or Bing are still available if I want. (I'm not affiliated with the site in any way, just a happy user.) Note that this will disable Yahoo! search, so if you use that you could replace one of the other sites instead.
[crarko adds: You should be able to switch to any search site you like using this method. Just replace the IP address mapping from the hint in your /etc/hosts with the address of the site you want to substitute. Be prepared for the possibility of doing some revamping after June 6th, 2012, when the IPv6 rollout begins in earnest.
Also bear in mind that editing hosts will affect all applications, not just Safari.]
Recently, I was playing around with Safari's Reading List feature, and I was pleased to see that there is a Services menu item to add links to the list from other applications. Unfortunately, it didn't work for a bunch of the URLs that I tried to add.
The link detection scheme is overly strict and it seems to only work with well formed URLs that contain the scheme. This didn't help at all when trying to add links from Twitter where just about every one is shortened and does not contain the http:// cruft.
I have been wanting to learn more about Automator and Applescript so without further ado I present my lax version of the 'Add to Reading List' Service.
To setup the service:
Launch Automator.
Choose the Service document type.
Service receives selected text in any application (default).
Type apple in the search field to find the Run AppleScript action.
Drag Run AppleScript to your workflow.
Replace the script contents with the code given below.
Save and give the Service a name
Assign a keyboard shortcut with System Preferences » Keyboard » Services.
Here's the script:
--
-- Automator Service - Add to Reading List - lax version
--
-- http://warmfuzzyapps.com/2011/07/add-to-reading-list-lax-version/
-- Wiley Wimberly
--
-- The default service that adds links to Safari's Reading List is a
-- bit on the strict side when deciding what constitutes a URL and it
-- doesn't work well for adding shortened URLs from apps like twitter.
-- This version is more tolerant and will prepend http:// if the
-- selected text does not already start with http:// or https://.
--
-- Service receives selected text in any application.
on run {input, parameters}
set theItem to item 1 of input
if theItem starts with "http://" or theItem starts with "https://" then
set theUrl to theItem
else
set theUrl to "http://" & theItem
end if
tell application "Safari"
add reading list item theUrl
end tell
return theUrl
end run
From this blog post. The code is also listed here.
[crarko adds: This pretty much just reformats the URL so Safari will be happy with it.]
In Safari when I want to check my iCloud mail, it's usually in two steps:
First: I open iCloud.com in Safari. Second: Click Mail icon in iCloud, and I have my e-mail messages.
Now I can do this in just one step:
If I instead bookmark https://www.icloud.com/#mail in Safari's Bookmarks bar, I can go straight to the Mail inbox in iCloud with just one click. Almost like accessing a Gmail account.
This is also valid for Contacts, Calendar and iWork:
https://www.icloud.com/#Contacts
https://www.icloud.com/#Calendar
https://www.icloud.com/#iWork
These shortcuts are great if you need fast access to you favorites iCloud apps.
[crarko adds: I haven't tested this one. It seems pretty straightforward.]
In previous versions of Safari, one could right click on a PDF being viewed in Safari and there was an option to 'Open with Preview.' In version 5.1, this functionality had seemingly disappeared.
I searched the web to see if I could find an answer to restoring the pre-5.1 behavior, but couldn't find anything. Fortunately, I stumbled upon the answer by accident: In the new version, to have that option enabled in the contextual menu, you have to have something selected. So if you're viewing a PDF and want it opened in Preview instead of Safari, just hit Cmd+A or 'Select All' from the Edit menu, now right-clicking shows you the 'Open with Preview' option again.
Why Apple changed this, I don't know, but I find it bizarre and arbitrary because this action that used to take a mouse click and movement to perform now takes a key combination plus a mouse click and movement.
But I find most of my time spent screwing around with computers these days is spent trying to restore functionality that used to be efficient and rapid, but has changed with a software update to be less so.
[crarko adds: I tested this, and it works as described. It is annoying when functionality disappears (or is hidden) for no apparent reason.]