- the browser’s user agent string contains the word “Macintosh”
- the browser is Internet Explorer and the iTunes ActiveX component installed
- the browser is Firefox and the iTunes Mozilla plugin is installed
- an iTunes cookie named “iTunesPresent” set to true in the domain of the Apple web site visiting or in “.apple.com”
The $64 question now is what’s the best way to get the “iTunesPresent” cookie set in domain “.apple.com”.
My first thought was to configure Chrome to use a user agent string containing “Macintosh” and then launch iTunes from the iTunes web site once thereby setting the cookie.
I was perplexed when this didn’t work. Using the built-in debugger in Chrome I proceeded to set a break point in the iTunesDetected function and then single stepped through the function to see what was happening. Even thought I had set my user agent string to “Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10_5_3; en-us) AppleWebKit/525.19 (KHTML, like Gecko) Version/3.2.1 Safari/525.19” using the Chrome command line switch “–user-agent=” debugging showed me that “navigator.agentString” was still set to the default Chrome UAS.
I then reloaded the page and after the breakpoint triggered, I changed “iTunesDetected()” to “true” and began to single step through the code. Once I entered function “its.cookies.setUnescaped” I proceeded to change “if (domain)” to “if (true)” and hard-coded the setting of domainString to ” domain=.apple” (see lines 216 and 217 below).
My PC now contains the iTunesPresent cookie in the “.apple.com” domain which now allows me to automatically launch iTunes from web pages on the iTunes web site using Google Chrome.
Why Apple doesn’t directly support Google Chrome remains a mystery to me. I understand that Google Chrome is a competing product to Apple’s Safari browser, however, I am confident that Apple will make far more revenue from the iTunes store by making the user experience of iTunes best-in-class using any platform or browser.