Submit Hint Search The Forums LinksStatsPollsHeadlinesRSS
14,000 hints and counting!

Use one bookmark to load different versions of a site Web Browsers
I have several sites that I access on both my iPhone and desktop, so I like to have quick access to them via the Bookmarks Bar. However, these sites have different versions for the desktop, for mobiles, and, in some cases, yet another version for the iPhone. Usually, the full version doesn't work so well on the iPhone, and the iPhone version is undesirable on the desktop.

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'}
For Google Translate, which has a nice iPhone version if you open the right URL, but a stripped-down mobile version if you just go to translate.google.com on your iPhone or iPod, this looks like
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'}
To create this bookmark, copy the above code, create a new bookmark with the Bookmarks » Add Bookmark command, paste the code into the Address field, and give your bookmark a memorable name. Once you have one bookmarklet, you can make copies that work with the sites of your choice. Note that the URLs have to be enclosed in single quotes ('), and that spaces and line breaks will probably break the bookmarklet.

Using bookmark-syncing software, you should be able to use these bookmarklets in other browsers and on other operating systems.
    •    
  • Currently 3.53 / 5
  • 1
  • 2
  • 3
  • 4
  • 5
  (15 votes cast)
 
[5,799 views]  

Use one bookmark to load different versions of a site | 3 comments | Create New Account
Click here to return to the 'Use one bookmark to load different versions of a site' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
Use one bookmark to load different versions of a site
Authored by: MJCube on Mar 10, '10 11:53:47AM

Elegant, geeky, and very useful!



[ Reply to This | # ]
Use one bookmark to load different versions of a site
Authored by: OverZealous on Mar 10, '10 01:55:56PM

This reminds me why I really hate the way Apple chose to manage the bookmarks on the iPhone / iPod Touch. It just doesn't make sense to have the same bookmark sets for both mobile and desktop devices.

Not only the issue described above, but I have hundreds of bookmarks in my browser, but probably only about 20-30 I use on my mobile device. I don't really need every little flash-based game, random document, etc, on my device.

Thankfully, I use Firefox as my desktop browser, so Safari is just where I track my iPod Touch bookmarks. But it's a huge deterrent for me if I ever wanted to switch. (At least when I was on Windows I could use IE to store the bookmarks, since it would have been/will be a cold day in Heck before I switched back to IE.)



[ Reply to This | # ]
Use one bookmark to load different versions of a site
Authored by: PCheese on Mar 10, '10 02:56:11PM

I just added a bookmarks folder named "iPhone" in Safari's bookmark manager.

On the iPhone, I never navigate higher than that folder in the hierarchy; all my device bookmarks are organized in subfolders there.

On Safari, the folder only appears in the bookmark manager (neither in my bookmarks bar nor in my bookmarks menu).

The only time bookmarks from one device appear on the other during my regular workflow is when I'm manually entering a URL in the address bar: suggestions from my bookmarks appear below it, which is fine.



[ Reply to This | # ]