Skip to content

Instantly share code, notes, and snippets.

@Sakurina
Created March 9, 2012 06:08
Show Gist options
  • Save Sakurina/2005281 to your computer and use it in GitHub Desktop.
Save Sakurina/2005281 to your computer and use it in GitHub Desktop.
open a foursquare venue from a browser in the iOS app (original src + Closure Compiled bookmarklet)
javascript:(function(){var a=document.location.pathname.split("/"),b=a.length-1;if(!(0>=b)&&"v"==a["touch"==a[1]?2:1])document.location="foursquare://venue/"+a[b];})()
(function() {
// Open foursquare Venue in iOS App
var components = document.location.pathname.split("/");
var last = components.length - 1;
if (last <= 0) return;
var touch = components[1] == "touch";
var checkForV = touch ? 2 : 1;
var onVenue = components[checkForV] == "v";
if (!onVenue) return;
// Get venue ID
var venueID = components[last];
document.location = "foursquare://venue/"+venueID;
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment