Below is a boiled-down version of the problem I'm having.
I have a web page with a list of links to different kinds of files hosted remotely (S3). It looks something like this. I want the links to open in a different tab, so I'm using target="_blank"
. If the browser's default behavior is to download the file, that's fine too.
<a target="_blank" href="https://my-hosted-files.com/materials.pptx">
Link to powerpoint
</a>
<a target="_blank" href="https://my-hosted-files.com/intro.mp4">
Link to video
</a>
<a target="_blank" href="https://my-hosted-files.com/onboarding.docx">
Link to document
</a>
This works for most browsers, but on iOS Safari, I'm encountering a very specific bug.
4 and 5 are not acceptable behaviors. I've tried trying different things, like adding rel="noopener noreferrer"
and download
to the anchor tag but to no avail.
How can I fix this so users can still download non-MP4 files after viewing the video?
Thank you in advance.
I ended up removing target="_blank"
just for links to MP4 files. Since the original tab is preserved even without target="_blank"
, it was not necessary.