In addition to restoring in-window tabs, it turns out that there are a number of other hidden preferences available in the Safari 4 Beta. In the interest of efficiency, I've chosen to list all of them that I know about (as of today, at least) in this one hint. As more are uncovered in the future, I'll run those as standalone hints. But for now, here's a list of seven (in addition to the one to move the tab bar) more tweaks you can apply to Safari 4 Beta.
Each of these are boolean variables, meaning they take a TRUE or FALSE argument. They also all default to TRUE, so to enable each one, you need to set its value to FALSE. To do that, use this command template in Terminal:
There isn't an obvious way to add sites to Safari 4 Beta's new Top Sites page, but this is a Mac after all, so it occurred to me that drag and drop might work, and it does:
Open the top sites window.
Click the Edit button.
Open the web site you'd like to add to Top Sites in another window.
Drag the want-to-add site's site icon (it appears to the left of the URL) from the URL address bar into the Top Sites window. You can position the site while you're dragging it, too.
Drop the site when it's in the position where you'd like it to stay -- the site will be pinned to this position automatically.
[robg adds: This works as described, making Top Sites much more useful to me; there are sites I like to show on my Speed Dial page in Firefox, for instance, even though I don't visit them all that often.]
If you open many tabs in Safari for webpages that have Flash content, you've probably noticed Safari's processor usage skyrocket. clicktoflash is an open source Safari (WebKit) plug-in which prevents Flash loading unless you click the graphic representing the Flash content. I find Safari is much more stable as a result and quicker at loading webpages.
[robg adds: An earlier hint discussed using SafariStand to do the same thing. SafariStand, however, is a complex add-on that many users may prefer not to add to Safari. clicktoflash does just one thing, and after testing it for a day or so, I can say it works quite well. In Firefox, I use the FlashBlock plug-in to do the same thing.]
If you want to clean your Safari cookies, but you want to keep certain (login) cookies, you could manually remove cookies from the Safari preferences menu -- Safari » Preferences » Security » Show Cookies. However, that can be time consuming. As an alternative, try this Perl script:
### Edit this to your liking (put a pipe character between two words)
my $keepCookiesWith = "aap|teun|betterbe|tweakers.net";
### Put your OS X short username here (there should be a directory with the same name under /Users)
my $userName = "teun";
### ### ### Don't edit beneath this line unless you know some Perl
my $path = "/Users/$userName/Library/Cookies/Cookies.plist";
my @date = localtime();
my $date = sprintf("%04d%02d%02d", $date + 1900, $date + 1, $date);
my $cookies = read_file($path);
rename ($path, $path . "." . $date);
print WH <<EOF;
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
while ($cookies =~ m#(\s*<dict>.+?</dict>)#gs)
my $cookie = $1;
if ($cookie =~ /$keepCookiesWith/)
print WH $cookie;
print WH <<EOF;
This code will back up your Cookies.plist file, and create a new one with only the cookies that match the regex you put in $keepCookiesWith.
To use the script, save the code as cleanSafariCookies.pl (or some other name), somewhere on your hard disk. Put something in $keepCookiesWith and in $userName. Give the file execute permission with chmod 755 cleanSafariCookies.pl, and run it in Terminal by typing (assuming you're in the directory where the program is located) ./cleanSafariCookies.pl.
This could easily be rewritten in the language of your choice, if you desire.
I use the proxy-based ad blocker GlimmerBlocker and visit sites, including Macworld, that use Pheedo. I noticed that the Macworld vodcasts were turning up empty in iTunes. The cause, it turns out, is that GlimmerBlocker blocks Pheedo.
There is a workaround though -- just create your own list, and add a whitelist for host www.pheedo.com, path /click.phdo with priority 3. Then any Pheedo-using sites will work just fine.
I noticed that Safari was getting a bit slow to load the Flash plug-in the first time in every browsing session. After a quick look in my Internet Plug-ins (/Library/Internet Plug-Ins) folder, I found two files related to the Flash Player. A recent one (Flash Player.plugin) and an old one (flashplayer.xpt). After removing the .xpt file, Safari become far snappier to load flash the first time.
I guess the .xpt file is an old version of the plug-in that I dragged with me during successive installs and migrations; I expect a lot of users may have the same issue. (I had the same problem on my home Mac and my work Mac).
Within some online text editors, such as TinyMCE, Firefox (on a MacBook) will handle Command-Left Arrow as 'go back one page' rather than 'go to the start of the current line.' Likewise, Command-Right Arrow will take you forward a page, but if there's not a page to go forward to, this often results in moving the cursor to the end of the current line after all.
To see this in action, go here, and from that page, go to Examples and then to Documentation. Now, go back one page. On the Examples page, change some text and hit Command-Left Arrow while the cursor is still within the editor. Firefox will take you back another page, losing any changes you made. If you try the same thing in Safari, it would simply move the cursor to the start of the current line. Likewise, for Command-Right Arrow, Firefox takes you forward to Documentation, where Safari would move the cursor to the end of the current line.
The solution is simple -- use the keyconfig add-on. After installing keyconfig, go to Tools » Keyconfig, click on the "Back : Command-Left Arrow" entry, then click the Disable button. Next, select the "Forward : Command-Right Arrow" entry and click Disable. That's all. To navigate from page to page, use Command-[ and Command-].
While we're at the subject, if you don't want Delete/Backspace to take you the previous page when your cursor happens to be outside any textbox, see this hint. You could probably accomplish the same result by using keyconfig by disable the "Back : Backspace" shortcut.
[robg adds: When I tested this hint in Firefox 3.0.5, the modified text in the TinyMCE editor showed up, even after going forward or back away from the page. If you're interested in learning more about keyconfig, this hint explains in a bit more depth about how to use it to set up your own keyboard shortcuts for commands that don't have menu item entries.]
For the paranoid, the pornsurfer, as well as anyone with a not-undue concern about online tracking, it is useful to be able to automatically delete all cookies when quitting one's browser.
For most of the history of Safari, although the browser did not provide a way of erasing all cookies at shutdown, the facility could be emulated by setting one's ~/Library » Cookies » cookies.plist file to "read only" (see this hint). Since cookies are stored in memory until the browser shuts down, the result was a perfectly normal browser session with no cookies carried to the next session.
This ability went away with 10.5, as a read-only cookie file caused random issues at most sites requiring a login cookie. There was no option but to reset the cookie.plist file to read/write, and delete them by hand every now and then.
The problem has been resolved in 10.5.6, but the technique for achieving it is slightly different -- you now must set the containing folder to read-only, not the file. Read on for a detailed walkthrough, if you need it...
Today, I had a process running amok and filling up my boot volume. This was bad, as Safari seems to have tried to update my RSS feeds and failed in the process, leaving a Database3_BROKEN file in my user's Library/Syndication folder. This was especially annoying as I have a backlog of hundreds of unread articles. On several sites, this amounts to more articles having been accumulated than entries in their respective RSS feeds. It would have required a lot of work to check all the sites I have subscribed to manually. So I set out to find a solution that did not involve trashing my old Syndication database.
If the command above works without errors, the Database3-repaired file is probably OK and you can rename it to Database3. The best thing about this is that it may serve you in many other similar cases on Mac OS X, as SQLite is very widely used. Thus a more general version of the command:
sqlite3 broken.db .dump | sqlite3 repaired.db
A word of caution though: check the repaired database carefully before relying on it. According to the somewhat unrelated discussion that led to this solution, this may not work for a database if the application using it died in the middle of a commit. This can result in both records and index being broken. In any case, this should be worth a try.