0

I have a QR code reader in X Code, and when it detects a web page it should open a web view. It works like a charm, though it can't detect an audio file. I have a link, which loads an audio in a browser, and in my app redirects to an error. This is the url.

In a browser the .html become mp3 and the audio is playing automatically.

How can I detect whether it is an audio or a website?

j0k
  • 22,600
  • 28
  • 79
  • 90
NDM
  • 944
  • 9
  • 30

1 Answers1

0

All you can do is hit the URL and look at the Content-Type header returned.

You can use a HEAD request where supported, and fall back to GET if needed, and simply disconnect once you have the appropriate headers.

Brad
  • 159,648
  • 54
  • 349
  • 530
  • @IOSDEV, A `HEAD` request is for headers only. There would be no content to display. – Brad Oct 04 '12 at 13:06