In Safari 6, when you type into the omnibar - what Apple calls the "address and search field" - the autocomplete menu that shows suggestions for what you typed may be very long. If you want to select your bookmarks or history with the keyboard, you have to press the down arrow many times to get to them.
You can skip sections by holding down the Command key while pressing the up- or down-arrow buttons. So if you've typed something in the address and search field, you can press Command-down arrow to skip past the search engine suggestions, and then use the arrow key alone to select the item you want.
Google introduced a custom print dialog to Chrome a few versions ago. This adds a step to saving a PDF or using any of the other standard options. Until recently, this could be disabled in chrome://flags/. They have since removed the flag, but they did leave the command line option to disable it.
A workaround is to create an AppleScript applet that launches Chrome with this option. The following script does exactly that, assuming Chrome is located in your applications folder:
Open AppleScript Editor, paste the above into a new window, then save it as an application. If you run this applet to launch Chrome, you'll get a standard Print dialog (though interestingly it's a dialog window, not a sheet).
I've been wondering when the 'skip to top' functionality that is now a staple in so many iOS apps would appear on OS X. It seems to be here now, albeit in a limited fashion. As such, this hint only seems valid for Firefox.
In order to skip to the top or bottom of a web page, simply swipe up or down on your trackpad using three fingers.
[kirkmc adds: Yes, this works in Firefox, and in Opera, it moves about 4/5 of a screen.]
It seems like Apple disabled the "Press Backspace to go back a page" feature in Safari 6 due to users having complained about losing text entered in text fields when they accidentally pressed the backspace key. If you liked this feature, you can enable it again using this command:
defaults write com.apple.Safari NSUserKeyEquivalents -dict-add Back "\U232b"
If you ever want to disable it, there are two possibilities. The first, if you don't have any other shortcuts for Safari, is to run this command:
The second method is a bit more time-consuming. You need to first create a keyboard shortcut for Safari, for the "Back" command, in the preferences. Then, if you apply the first command above, you'll be able to delete it. If you don't have a shortcut set up for the Back command before running the first command above, it won't display in the Keyboard Shortcut preferences, and you won't be able to delete it from the preference pane. It seems like using the defaults command to set up a shortcut only displays that shortcut in the preference pane if you already have a shortcut created.
The Activity window can be extremely useful for quickly finding resources for a web page, identifying which ones failed to load, etc. However, with a lot of pages open, it often shows too much information by default, as each web page's disclosure triangle is expanded. This takes longer to view the page and requires you to scroll to find the site you want to check, if you have multiple windows or tabs open. Fortunately, Safari has a setting that controls this behavior, although it isn't accessible via the GUI.
Simply type the following in Terminal to make the Activity window open with all sites collapsed by default:
defaults write com.apple.Safari ActivitiesStartExpanded -boolean NO
Quit and relaunch Safari for this to take effect.
To reverse the setting, simply invert the last argument:
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.]