0

I'm trying to get iTunes to launch from a html page loaded in a UIWebView.

Using the example from Apple's documentation

http://developer.apple.com/library/ios/#featuredarticles/iPhoneURLScheme_Reference/Articles/iTunesLinks.html#//apple_ref/doc/uid/TP40007896-SW1

 <a
 href="http://phobos.apple.com/WebObjects/MZStore.woa/wa/viewAlbum?i=156093464&id=156093462&s=143441">
 <img height="15" width="61" alt="Randy Newman - Toy Story
- You&#39;ve Got a Friend In Me" src="http://ax.phobos.apple.com.edgesuite.net/images/
 badgeitunes61x15dark.gif"></img> </a>

When I click on the button didFailLoadWithError: will get called with WebKitErrorDomain 101.

(shouldStartLoadWithRequest: returns YES for any requests)

The same html page loaded in a browser works.


(There's actually another problem with that code, see this link Remote image doesn't get displayed in html page displayed in UIWebView

But after changing it to this it still doesn't work in UIWebView but does in a browser

  <a href="http://phobos.apple.com/WebObjects/MZStore.woa/wa/viewAlbum?i=156093464&id=156093462&s=143441">
      <img height="15" width="61" src="Btn_Go.png""></img>
  </a>
Community
  • 1
  • 1
Gruntcakes
  • 37,738
  • 44
  • 184
  • 378

1 Answers1

0

You will find what you seek in this question.

The answer uses -webView:shouldStartLoadWithRequest:navigationType and the url scheme of the clicked link to determine if the link should be opened by the system or in the webview.

It also takes care of the error you mention. (But only by ignoring it..)

Community
  • 1
  • 1
matsr
  • 4,302
  • 3
  • 21
  • 36