Here's a quick way to go back and forward while using Safari on OSX Lion (10.7). It also allows you to peek at the webpage that you were on previously.
While using Safari in Lion, use the two finger left or right swipe will take you back or forward, respectively (the direction will be dependent on whether you use natural or reverse scrolling -- I use reverse scrolling). Doing the gesture slowly will give you a peek instead of doing a full back or forward.
[crarko adds: The trackpad on my old MacBook doesn't support these gestures, but if you have a newer machine give this a try, and post results in the comments if you want.]
Full-screen Safari is nice, but some pages don't do well with the Reader option, and are hard to read on an extremely wide-screen monitor.
If you move the mouse cursor all the way left (or right), the pointer changes to a horizontal-resize indicator. At this point, you can click and drag toward the center, to change the width of the page while the browser stays in full-screen mode. A gray linen background appears on the left and right of the resulting narrower page.
Each tab can be adjusted independently.
[crarko adds: I tested this, and it works as described. I tried this in Preview and it seemed to resize the page automatically when switched to full-screen mode.]
Restore previous Safari version from .SafariArchive.tar.gz
Did that new Safari update (5.1) break something and you'd like the old version back? Thanks to Apple's prescient yet secretive engineers, there's a way.
When Safari does an upgrade it saves the previous version in this location:
In Lion, Reading List was added to Safari. It appears, by default, in the Bookmarks Bar. If you're like me and have little space to spare up there, it can be useful to get rid of the Reading List icon if you don't use it, or move it up to the Toolbar instead.
To get rid of the icon in the menu bar, open Terminal and run this command:
The shortcut combination Command+?, which works out to Command+Shift+/ opens the Help search box from any application in OS X. I have found that this can be a convenient way to run menu commands without having to navigate the sometimes complicated labyrinth of nested menus and ambiguious function locations in various applications.
After invoking the shortcut, simply type a portion of the menu command that you would like to execute and search results will be displayed, which you can navigate with the arrow keys, and then hit Return to execute.
This function is documented, but has an extended use because it works for the dynamic contents of menus, such as bookmarks and history items in any browser, and the contents of the File » Open Recent submenu in other applications, allowing quick, Spotlight-esque access to recent files and boomarks from within any application.
For instance, I have hundreds of bookmarks in my Bookmark menu in Safari. Even though they are organized into sub-menus, visually scanning them for the desired link is an arduous process, and this method allows instantaneous searching and launching of a specific bookmark.
I should note that similar functionality can be obtained with Command+Option+B in Safari, with live previews, but the method given here is browser independent and faster, as it has no graphical previews or new window to open.
[crarko adds: I tested this in Safari, Firefox, TextEdit and BBEdit and it worked as described. I searched for 'Bookmarks,' 'History,' and 'Open Recent' to get to those respective menus.]
If you're a Google Chrome user, you may like its Omnibar because it allows you to instantly search the web and leverage your URL history at the same time. This hint explains how to instantly get to an Omnibar from within any application.
You need two things for this hint: An AppleScript and a hotkey manager. For the hotkey manager I use Quicksilver but anything that allows you to run AppleScripts or applications on a keystroke is fine.
For the script, open AppleScript Editor and save the following code as a script (or an application if you're going to run it as an application), for example calling it Open Omnibar.
tell application "Google Chrome"
if (count of windows) is 0 or front window is not visible then
make new window
make new tab at end of tabs of front window
What this code does is first it checks if any Chrome windows are visible, if not it opens a new window. If a window is visible you get a new tab. Chrome automatically places the cursor in the Omnibar.
So if you assign this script to a hotkey, you can simply hit the hotkey and when you see the Omnibar, start typing.
[crarko adds: I haven't tested this one. If you're running Snow Leopard you could probably set this up as an Automator Service that runs the script.]
In Safari, we all know if you highlight some text and then Control+click (or right mouse click) you get a pop up contextual menu. I use this to search text in Google all the time, but didn't like that it would open in front while I was still reading the web page. So with a little experimenting, if you hold down the Command key before you click on 'Search with Google' in the pop up menu, the page will open in a tab behind your current one.
[crarko adds: I tested this, and it works as described.]
To date, people who wanted to view downloaded PDFs on a Mac have had three options:
Use Safari's in-line PDF viewer plug-in to view PDFs in Safari.
Use Firefox v3 and the Firefox PDF plug-in for Mac to view PDFs in Firefox.
Use a current version of Firefox, download the PDFs, and view them in a PDF reader app.
That's right -- there was no way to view PDFs in Firefox 4 or 5 as one could do in Safari, because the Firefox PDF plug-in didn't work above Firefox 3.6.
That is, it didn't officially work. But it turns out that with some simple modifications, you can get this plug-in to work just fine in Firefox 5 and probably future versions of Firefox, thus allowing you to view PDFs in the browser once again.
With the Applications folder open in Finder, do a Get Info on Firefox.
Check the box for 'Open in 32-bit mode.'
If Firefox is currently open, quit and relaunch it.
You should get a file called fx-quartz-pdf-1.2.0.xpi in your Downloads folder. Double-click it to decompress it.
Inside the resulting folder, you'll see 'install.rdf.' Open this file in TextEdit or vi or another simple text editor.
Look for a line reading '<em:maxVersion>4.0.*</em:maxVersion>'.
Change that 4 to 20. (Or you could change it to 5, but since Firefox is going to go through version numbers pretty quickly, you should pick one pretty far out.)
Save and exit.
Select all the files in the fx-quartz-pdf-1.2.0 folder, right-click on them, and select 'Compress 6 items.' Do NOT compress the containing folder or it won't work later on.
Now you'll have a file called Archive.zip. Rename this file fx-quartz-pdf-1.2.0.xpi.
In Firefox, go to the Tools menu and select Add-Ons.
At the top of the window, look for the button with the gear icon. Click this and select 'Install Add-On from File.'
Browse to and select the fx-quartz-pdf-1.2.0.xpi file you created.
Approve the add-on installation when prompted.
Now this may work fine for some of you and you may be done. Test the add-on by attempting to open an online PDF. If it opens in the browser, great, you're done. But in my case, more work was required, because Firefox claimed that the add-on was installed, but it wasn't actually working. So I had to do some additional clean-up.
Open ~/Library/Application Support/Firefox/Profiles/[random_characters].default/extensions/.
You should see a file called firstname.lastname@example.org. It's the compressed file we created earlier, but with a different name. I think this is why it's not working. If you see a folder called email@example.com instead, you have some other problem.
Go up one level to the [gibberish].default folder. You should see a file called extensions.ini. Open this file in your text editor.
Look for an entry that ends with firstname.lastname@example.org.
Remove the '.xpi' extension.
Save and exit.
Back in the extensions folder, double-click on email@example.com. This should expand it into a folder named firstname.lastname@example.org. If necessary, delete the previous .xpi file.
Launch Firefox 5. It should properly display PDFs in the browser now.
The Private Browsing mode in Safari has no default keyboard shortcut, and the toggle has a modal confirmation dialog. This hint shows how to assign a keyboard shortcut to Private Browsing and bypass the confirmation dialog.
One of my favourite features of Mac OS X is the ability to assign a keyboard shortcut to any menu item of any application. This is fairly straightforward and was covered in many hints before.
In order to assign a keyboard shortcut, in this case to the Private Browsing toggle in Safari, we have to do the following:
Open System Preferences and navigate to 'Keyboard' section.
Select the 'Keyboard Shortcuts' tab.
Select 'Application Shortcuts' from the list.
Click on the Plus sign, select the application, type in the name of the menu item, and enter the shortcut.
The instruction says that we should 'Enter the exact name of the menu command you want to add.' When doing so, i.e. type 'Private Browsing…' the keyboard shortcut will execute the default action and presents the confirmation dialog window.
In order to bypass that dialog, we have to type 'Private Browsing' (without the elipsis) as the menu item name. As a result, the keyboard shortcut will instantly toggle private browsing on and off.
You will notice that there are now two menu items in Safari menu called Private Browsing, one with the shortcut assigned, and the default one with the elipsis.
The shortcut I use is Command+Shift+P. It is easy to remember, does not interfere with printing (Command+P), and makes private browsing a feature I actually use on a regular basis (e.g. when accessing my bank account).
[crarko adds: I tested this, and it works as described.]