Update: Remember always to check stackoverflow first. I found an easier way to accomplish the same thing there. See stackoverflow question 818973 See also the iTunes Link Maker from Apple
It has been fairly easy on the desktop to open iTunes with all the iPhone apps from a developer. Doing the same on the iPhone has been practically impossible, but the other day (or rather night) I managed to solve this problem. By using the URL protocol for the AppStore on the iPhone with a specially crafted web search access AppStore will open with a predefined search expression. Neat.
After I solved this little interesting problem I wrote a small php script that check the useragent string. If the string contain the word iPhone a redirect to the URL that open the AppStore app is returned. Otherwise a redirect to a normal web page is returned.
Below you can see this short php script. I have separated the AppStore URL into three parts so it doesn’t wrap in the browser.
File: Active link more.php
<html>
<head>
<?php
$part1 = "itms-apps://ax.search.itunes.apple.com";
$part2 = "/WebObjects/MZSearch.woa/wa/search?media=software&term=";
$part3 = "Memention%20AB"; // Place the desired search string here, escape spaces
$userAgent = $_SERVER['HTTP_USER_AGENT'];
if ((''==$userAgent) || (FALSE !== strpos($userAgent,'iPhone')))
{
// This part will be returned to an iPhone
?>
<meta http-equiv="Refresh" content="0; url=<?php echo "$part1$part2$part3"; ?>">
<?php
}
else
{
// This part will be returned to anything not an iPhone, change target URL
?>
<meta http-equiv="Refresh" content="0; url=/software.html">
<?php
}
?>
</head>
<body>
</body>
</html>
By Edward Patel, 15 Aug 2009
Tweet
Show comments