Submit Hint Search The Forums LinksStatsPollsHeadlinesRSS
14,000 hints and counting!

Make Google Chrome use standard print dialog Web Browsers
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:
do shell script "/Applications/Google\\ Chrome.app/Contents/MacOS/Google\\ Chrome --args --disable-print-preview > /dev/null 2>&1 &"
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).
  Post a comment  •  Comments (7)  
  • Currently 2.61 / 5
  You rated: 2 / 5 (23 votes cast)
 
[10,598 views] Email Article To a Friend View Printable Version
Skip to top/bottom of web page Web Browsers
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.]
  Post a comment  •  Comments (9)  
  • Currently 1.96 / 5
  You rated: 5 / 5 (23 votes cast)
 
[8,646 views] Email Article To a Friend View Printable Version
Re-enable the backspace key to go back a page in Safari 6 Web Browsers
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:
defaults delete com.apple.Safari NSUserKeyEquivalents
It will delete all Safari keyboard shortcuts.

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.
  Post a comment  •  Comments (13)  
  • Currently 2.81 / 5
  You rated: 4 / 5 (26 votes cast)
 
[31,288 views] Email Article To a Friend View Printable Version
Set Safari's Activity window to have items collapsed by default Web Browsers
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:
defaults write com.apple.Safari ActivitiesStartExpanded -boolean YES
  Post a comment  •  Comments (6)  
  • Currently 2.55 / 5
  You rated: 4 / 5 (44 votes cast)
 
[5,595 views] Email Article To a Friend View Printable Version
Pause animated GIFs in Safari Web Browsers
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.]
  Post a comment  •  Comments (4)  
  • Currently 2.82 / 5
  You rated: 3 / 5 (22 votes cast)
 
[8,786 views] Email Article To a Friend View Printable Version
Browser wars poll #11: Which web browser do you use most on OS X? Web Browsers
It's been a while, so here's a new poll, asking Which web browser do you use most on OS X? If your favorite isn't in the list, feel free to add a comment.
  Post a comment  •  Comments (23)  
  • Currently 3.00 / 5
  You rated: 5 / 5 (10 votes cast)
 
[4,354 views] Email Article To a Friend View Printable Version
Automate the download of YouTube videos in Safari 5.1 Web Browsers

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?]
  Post a comment  •  Comments (11)  
  • Currently 3.00 / 5
  You rated: 2 / 5 (7 votes cast)
 
[14,870 views] Email Article To a Friend View Printable Version
A mouse shortcut for adding a link to the Reading List in Safari Web Browsers
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.]
  Post a comment  •  Comments (9)  
  • Currently 3.71 / 5
  You rated: 3 / 5 (7 votes cast)
 
[4,812 views] Email Article To a Friend View Printable Version
Change Safari's default search engine Web Browsers
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.

Search for:

http://www.bing.com/search?q={searchTerms}&form=APMCS1

And replace with:

https://duckduckgo.com/?q={searchTerms}

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.

Search for:
68 74 74 70 3A 2F 2F 77 77 77 2E 62 69 6E 67 2E 63 6F 6D 2F 73 65 61 72 63 68 3F 71 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 31
And replace with:
68 74 74 70 73 3A 2F 2F 64 75 63 6B 64 75 63 6B 67 6F 2E 63 6F 6D 2F 3F 71 3D 7B 73 65 61 72 63 68 54 65 72 6D 73 7D 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20
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
And replace with:
20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20
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.]
  Post a comment  •  Comments (7)  
  • Currently 4.20 / 5
  You rated: 4 / 5 (5 votes cast)
 
[19,800 views] Email Article To a Friend View Printable Version
10.7: HTML5 Video Display Sleep Workaround Web Browsers
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.]
  Post a comment  •  Comments (1)  
  • Currently 3.67 / 5
  You rated: 5 / 5 (6 votes cast)
 
[3,608 views] Email Article To a Friend View Printable Version