I have a 22MB video on my homepage but when the screen goes narrow, the entire div won't show, to prevent it loading slowly on a phone.

Is the page still downloading the video and just not showing (bad thing) or is the CSS display:none preventing it from downloading (good thing).

  • Programming questions, such as this, are best asked on Stackoverflow. They are off topic here. – Rob Sep 20 '16 at 18:21
  • 2
    @Rob This isn't necessarily just programming related... it's directly relevant to a webmaster managing bandwidth on a site. – MrWhite Sep 20 '16 at 19:56
  • @w3dk The question is about what display:none; does which is a CSS question which is off topic here. – Rob Sep 20 '16 at 19:58
  • Videos are a bit more complex than something like an image, since the browser might only download a portion anyway, unless it is "played" in its entirety. Also relevant: stackoverflow.com/questions/12158540/… – MrWhite Sep 20 '16 at 20:55
  • if (is_mobile == true) { //do something } is your friend. – Simon Hayter Sep 20 '16 at 21:04

It is still being downloaded, and hidden, if you use display:none.

| improve this answer | |
  • Have you actually tested it with something like Fiddler? – wb9688 Sep 20 '16 at 18:20
  • @wb9688 - I haven't. I pretty much like the layout the way it is but might be considering making sure the video is super low quality or something. – Smaf Gal Sep 21 '16 at 20:43
  • How can you avoid the video from being downloaded? – molerat Jul 17 at 15:11

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.