Mar 10, '10 07:30:00AM • Contributed by: TomHopper
Instead of creating a plain bookmark, a little Javascript can make a bookmark context-sensitive, and allow you to have one bookmark that opens the right version of a page, depending on which platform you're browsing from. The basic idea is to use some client-side Javascript to check the browser's platform (a.k.a. operating system), and then tell the browser to access a URL based on that check. The code looks like this:
javascript:if((navigator.userAgent.match(/iPhone/i))||(navigator.userAgent.match(/iPod/i))){location.href='URL1'}else{location.href='URL2'}javascript:if((navigator.userAgent.match(/iPhone/i))||(navigator.userAgent.match(/iPod/i))){location.href='http://www.google.com/m/translate?hl=en&source=mobilesearchapp'}else{location.href='http://translate.google.com/#auto|en'}Using bookmark-syncing software, you should be able to use these bookmarklets in other browsers and on other operating systems.
