So after a looking around, I decided that the best way to go would be to write a bookmarklet that would generate the code to insert a link to IMDB. I'm no expert on this stuff and I'm sure there's something wrong with the below code, but it appears to work passably well (maybe I should just call it IMDB Bookmarklet - Beta). Basically, all you need to do is go to the movie you want to link to on IMDB, click the bookmarklet in your browser, then copy and paste the text into your post (IE actually has a function that will copy a string directly to your clipboard, but no other browser will do so because of obvious security reasons. Therefore, I simply used a prompt() function to display the generated text which you have to then copy manually.)
Anyway, here's the code:
Again, all you need to do is go to the movie you want to link to on IMDB, click the bookmarklet in your browser, then copy and paste the text into your post. This is the output of the bookmarklet when you use it on IMDB's Miami Vice page:
<a href='http://imdb.com/title/tt0430357/' title='IMDB: Miami Vice'>Miami Vice</a>A few nerdy coding things to note here:
- The link that is generated uses single quotes (') instead of the usual double quotes ("). Both work in HTML, but I usually use double quotes and would prefer consistency. However, as previously mentioned, using double quotes does not appear to work in Opera (even when escaped with \"). If you use firefox and want to get double quotes in the generated link, try this:
- The code is generated by reading in the page's URL and title tag. As such, I had to do some manipulation to remove the year from the page's title (otherwise the link would show up saying Miami Vice (2006). The way I did this may cause problems if a title has an open parentheses, but I tried to account for it. I might change it so that the year shows up in the title attribute of the link, but I don't think it's that big of a deal.
- Foreign movies will still show up with the foreign title. So Sympathy for Mr. Vengeance will show up as Boksuneun naui geot. Personally, I think this still helps, but I don't see an easy way of generating the link with the English title (and sometimes it's nice to use the foreign title).
- Now that I think about it, this would be helpful for linking to Amazon too. It seems like they make it more difficult to link using your Associates ID these days, so an automated way to do so will probably be helpful.
I realize this post has next to no appeal to the grand majority of my readers, but I ended up spending more time on this than I wanted. I'll see if I can make another post during the week this week...