0

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.

Baltazar
  • 1
  • 1

1 Answers1

0

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:

Community
  • 1
  • 1
Mick
  • 19,483
  • 1
  • 40
  • 91
  • Thanks for your answer Mick. Yes I know it won't autoplay on mobile therefor I want the browser to go straight to the main site (index2.html) without any interaction from the user, no mouse clicking and so on. – Baltazar Feb 09 '16 at 09:28
  • What I meant was that you may not need two separate index.html pages. You can have a single one with the video in the background, for example, and on a PC it will play and on a mobile it will not play but the rest of your site will still display. For example take a look at: http://dfcb.github.io/BigVideo.js/ or http://www.dadaabstories.org on your PC and your mobile device (if you look at the browser you will see they don't redirect). I think however you are saying that you want the video to play before the user sees the main site, when they are on a PC? – Mick Feb 09 '16 at 15:35
  • Yes sees the video before the main site on PC. – Baltazar Feb 09 '16 at 16:57
  • Is there anyone who has a suggestion on this how to completely skip the video if user is on handheld interface. – Baltazar Feb 13 '16 at 14:59