Link in video not clickable on mobile (iOS) in power saving mode

145 Views Asked by At

I have an autoplay video on my site which also serves as a link to another page. But now I found a problem in the power saving mode of the iPhone. Clicking on the video plays the video. But when I click again nothing happens. However, I would like the integrated link to open.

My code:

video {
  width: 80vw;
  height: auto;
  margin-left: auto;
  margin-right: auto;
  display: block;
}
<body>
  <a href="http://www.google.com">
    <video autoplay loop playsinline src="https://www.w3schools.com/html/mov_bbb.mp4" target="_self"></video>
  </a>
</body>

Can you help me so that the link also opens in power saving mode?

1

There are 1 best solutions below

2
AudioBubble On

You can accomplish this with JS and an onclick event.

const targetURL = "404.404";
// Not a real address

function openURL() {
  window.location = targetURL;
}
video {
  width: 80vw;
  height: auto;
  margin-left: auto;
  margin-right: auto;
  display: block;
}
<body>
  <video onclick="openURL()" autoplay loop playsinline src="https://www.w3schools.com/html/mov_bbb.mp4" target="_self"></video>


</body>

404.404 is not a real URL, it is just to produce a 404 error and demonstrate that the code redirects.