Er...somethin' like that.

Monday, November 28, 2005

Apple Store Link Bookmarklet

Jon posted a note about how hard it is to bookmark a page on the Apple Store. Based on his findings, I threw together a little bookmarklet that will transform an Apple Store session URL to a nice, tidy bookmarkable URL:

Apple Store Links

Just stick that in your bookmarks bar, and click on it at the product page. The page will refresh with your bookmarkable URL shown this time.

Fixed it! I guess reading from and writing to document.location.href at the same shot wasn't such a great idea. ;-) Now it works in Safari, Firefox, and even Internet Explorer, if you're, y'know...a masochist or something.

Oh, and props to Jesse Ruderman for his rockin' JavaScript Dev Environment and JavaScript Shell, without which writing this bookmarklet would've been a heck of a lot harder.

Update 2:
I'd intended to mention the trick that my bookmarklet uses to get the part number that it appends to the URL that Jon so helpfully provided. It turns out that the session URLs also contain the part number in a URL parameter called "nplm". For example:

My bookmarklet searches for that "nplm=" and grabs the next 11 characters after it. The slash in the part number is even already URI encoded for me.

No comments: