Baltazar February 2016

Skip video if user is on mobile

I want the html5 video to be automatically skiped if the user is on mobile and instead load main site (index2.html).

I'm a beginner but have read something of preload=none then the browser skips the video/buffering. I don't know how to code this though.

Answers


Mick February 2016

Most mobile devices ignore the autoplay attribute on a video and will not auto play a video.

This is to protect the users data usage and avoid data costs.

You may find that your site will already have the behaviour you require because of this - i.e. it will play the video on a desktop, but not on a mobile, and hence you can avoid having separate landing pages (index2.html etc).

Update

If you want to check whether your user is on a Mobile browser and then take one action rather than another (for example redirect to a different page with no video), there are a number of techniques to detect mobile browsers with Javascript. The one linked below is the one I personally prefer (currently...) - take a look at some of the other suggested answers to the question at the link also and you can get a feel for the alternatives:

Post Status

Asked in February 2016
Viewed 1,337 times
Voted 5
Answered 1 times

Search




Leave an answer