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?

1 Answer 1

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.

1
  • @IOSDEV, A HEAD request is for headers only. There would be no content to display.
    – Brad
    Oct 4, 2012 at 13:06

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.