How-To: Stop iTunes Web Links From Opening iTunes

57 Comments

A piece I wrote last week on the impact of iTunes web preview pages on App Store SEO brought up a little side conversation about how many people found it annoying that the links launch iTunes automatically. Sometimes you don’t even have any warning that the link is going to launch iTunes if you click on a shortened link. There are a few simple steps that you can take to stop this behavior and suppress iTunes in its eagerness to run and take you to the page for that app (or other iTunes content).

Below, I have outlined the steps for Safari, Firefox, and Chrome.

The Basic Concept

The iTunes preview pages run a JavaScript function that attempts to load iTunes by opening an ITMS file. This file will launch iTunes and direct the application to open the iTunes Store to the specified content. I did not want to recommend just disabling JavaScript because that would interfere with a lot of websites that rely on the interactivity that is possible with JavaScript. We will prevent iTunes from opening by changing the way that these browsers handle the ITMS file. This approach will allow you to manually launch iTunes when you desire. In the case of Chrome, we can selectively disable JavaScript for iTunes links.

Safari (see update below)

Safari uses the helper applications as defined in the “Get Info” dialog box for each file type. In Snow Leopard, Mac OS X relies solely on the file’s extension to determine the default application. This may behave differently in 10.5, which still respects the creator code attribute.

Create a simple text file on your desktop. The content of the file does not matter. Rename that file to “test.itms” and confirm that you do want to change the extension. Now select that file and pull up the “Get Info” dialog box (Command-I, right-click, or File » Get Info).

The “Open with:” section should show “iTunes.app (default)” at first. Click on the pull down menu there, select “Other” and then pick Safari. You will have to enable “All Applications” in the file selection dialog box. Clicking “Add” will return you to the “Get Info” window. Be sure to click “Change All…” to have that behavior work for any ITMS file, including ones you may download from iTunes web links in the future.

You must log out and back in for these changes to take effect. Restarting the computer would accomplish the same result.

You can still launch iTunes by clicking on the “View in iTunes” button on the preview page.

To reverse the setting, go back to the ITMS file (or create a new one) and change the “Open With” entry to iTunes.app and then click “Change All…” to make sure it will be used in all cases.

Firefox

Firefox uses a different method to define the helper app. Open a new browser window or tab and type “about:config” into the address bar. After dismissing the warning, you will be presented with a long list of options. Fortunately, we can use the search box at the top of this window to filter the results down to just the option we need. Type “itms” in the filter box and you will see an entry for “network.protocol-handler.warn-external.itms” as the only result (if you don’t get any results, keep reading for a solution). Double-click on the “false” entry below the “Value” column and change it to “true” and then close the window or tab. Restart Firefox to make sure the change is saved and used the next time you launch Firefox.

Now you should get a dialog box asking you what you want to do about this content type when you go to page. Click “Cancel” to prevent iTunes from opening or click “OK” to launch iTunes into the iTunes Store. Do NOT check the “Remember my choice for itms links” box or iTunes will automatically launch in the future. Unfortunately, I did not see this dialog box come up consistently, but here is what it should look like.

What if I don’t have an an “itms” entry in about:config?

If you do not have an entry for “network.protocol-handler.warn-external.itms” in the “about:config” page, do not panic. You can add a new entry by right-clicking on the page and selecting “New: Boolean” from the pop-up menu.

Type “network.protocol-handler.warn-external.itms” into the preference name field and click “OK” to create the entry.

The next step is to make sure the boolean value itself is set to “true” so that Firefox will ask what you want to do with iTunes links.

Additional Measures

If iTunes still launches automatically, check the settings in the applications tab of the Firefox preferences window and search for “itunes” in the filter box. If any content types are set to open with iTunes, change those settings to “Always Ask” and this should stop iTunes from opening. To double-check, do another search on “itms” and make sure it is set to “Always Ask” here as well.

To reverse the setting, return to the “about:config” page and double-click on the “true” entry for “network.protocol-handler.warn-external.itms” to change it back to “false” and disable the dialog box asking you what to do.

Chrome

Chrome has not implemented the “about:config” settings in Chrome for Mac, but it does have a nifty feature to disable javascript on specific sites. Open Chrome’s preferences and click on the “Under the Hood” tab.

Click on “Content Settings…” and then select the “JavaScript” tab.

Click on “Exceptions” and then use the “+” button to add “itunes.apple.com” and make sure this site is set to block JavaScript. Now when you load an iTunes web link, the site will report that iTunes cannot be found because the JavaScript function that is looking for it has failed to run and return a result.

While this solution works to shut down iTunes, it also means that you cannot click on the “View on iTunes” button on the page to launch iTunes manually. If you really want to get to the iTunes Store, copy the URL from the address bar and open the same page in Safari, or simply launch iTunes manually and search in the store.

To reverse the setting, return to the list of exceptions and delete the entry for “itunes.apple.com” by clicking on the “” button.

No More Autolaunching!

Automatically launching applications and slowing down my computer is almost as annoying as websites that start playing background music when you visit or DVD’s that play ads for soft drinks that cannot be stopped when all you want to do is watch a movie. Well, not nearly as bad as the stupid discs that will not let you skip to the movie, but still annoying. The steps above will help you take back control.

Safari Update

Many of you have reported that Safari/iTunes seem to reset our little fix, so here are some additional options for those experiencing this issue.

Safari relies on the Finder to define the default applications in the “Get Info” dialog box for each file type and the system to define the default helper application for URL schemes like “itms://” used by iTunes. With Chrome and Firefox, we can use settings within the app itself. With Safari, we have to modify the way the system deals with the files and URLs or add a plug-in to Safari itself.

Some may want to check out GlimmerBlocker which works by installing a proxy server on your local machine. All web requests from any application will be routed through this proxy. When the web page is returned to the requesting application, the page can be rewritten according to rules defined in the proxy.

Another approach is to change the system URL schemes for “itms://” to block Safari from launching iTunes even though the script still runs on the preview page. To do this, you will need to install RCDefaultApp and disable the “itms” URL type.

I did not want to modify the way the system deals with all HTTP requests or install a System PreferencePane. I chose to use GreaseKit, a Greasemonkey extension for Safari. After you install GreaseKit, you will need to install a script to block iTunes from launching on web preview pages. There is an existing script that will do this, but it includes some minor advertising for apptrackr.com. I wrote a simplified script that you can install to Stop iTunes from autolaunching that does not modify any other elements of the preview pages. This script will also work with Greasemonkey on Firefox.

57 Comments

Wil

I used the “stop itunes” script found here: http://userscripts.org/topics/49084 for Firefox and got the results explained here but I want the exact opposite, I want to see the link ONLY opened in itunes and not Firefox, so I don’t have to come back and close the worthless page that Firefox opened. Any help would be appreciated.

Ken

The GreaseKit script is still not working with my Snow Leopard & Safari setup.

Ken

Yep, the menu is there and all looks to be correct, but no joy on the functionality.

I’ll give the RCDefaultApp a try…

Josh

Silly question, but I gotta ask… do you see a checkmark to the left of the script name, in the GreaseKit menu? If not, it’s not enabled.

Ken

Yes, it was checked & enabled. I know, I know, troubleshooting 101. Still… :-)

It was plugged in and everything… :-)

japtor

I’ve used the posted Greasemonkey scripts before (with GreaseKit) and I found that they worked if you clicked directly on a link that matched their URL rules.

The problem I found is that a lot of links to the store are redirected from elsewhere (usually affiliate links), and for whatever reason GreaseKit or the scripts don’t catch those, so the request to open iTunes gets through (not sure how Greasemonkey handles it). I temporarily got around this by adding a URL rule for every different link I came across but that got tedious as hell.

I used to use SafariStand to just disable JS (like the Chrome tip) but it made the page look kind of ugly in the process. RCDefaultApp is a better way of doing it…the problem with both is that when you actually want to open iTunes, they disable the ability to open it from the preview page.

D

Chrome 5.0.307.11 beta on Mac OS X 10.6.2 seem to not have these buttons under ‘Under the Hood/Privacy’. With all the other ‘not workings’ I’m left wondering if the author has thoroughly vetted his “solution”.

mfichtner

Make that “remove the onload= parameter from all BODY tags”. The comment system stripped the body tag from my previous post.

bwillmore

Mfichtner… can you provide a little more detail on exactly what needs to be done in GlimmerBlocker? I’ve never used it before and wasn’t able to figure out exactly how one goes about removing the onload parameter within the program.

Weldon Dodd

mcfichtner – you need to create a new filter that will match on apple.com sites and then use the transform function. I think the full expression would be something like…

replace(/ onload=”[^”]+”, “”);

mfichtner

Or you could simply use GlimmerBlocker to remove the onload= parameter from all tags on itunes.apple.com. That way, web preview pages won’t even try to open iTunes. And since this is done in GlimmerBlock, it works for all browsers – no browser-specific tweaking required.

Weldon Dodd

I see that iTunes resets the cookies and the protocol handlers for Safari. I’m working on new instructions.

Ken

Didn’t work for me with Safari, either. This has really been annoying me of late, so I was psyched to see the article. Wish it could be made to work…

Cary

This doesn’t work for me with Safari. ITunes always keeps reclaiming that extension, even after a manually tell it to use the non-preferred app Safari (instead of iTunes) for all items with that extension

HD

Great tip and I couldn’t agree more with the reasoning behind it. I never understood why iTunes had to open as well. Awesome there is a way around it.

Comments are closed.