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?
All you can do is hit the URL and look at the
Content-Typeheader returned.You can use a
HEADrequest where supported, and fall back toGETif needed, and simply disconnect once you have the appropriate headers.