Does "display:none" prevent content being loaded?

3.7k views Asked by At

I want to hide a video on mobile devices. I did this by using "@media screen and (max-width: ###px)" and "display:none", this works fine but does that prevent the video from being loaded?

Basically I want the video to be not loaded with mobile data roaming, so that users on mobile devices won't use their roaming data for that.

Is there a more convenient way of doing this?

2

There are 2 answers

0
HopAlongPolly On

If you are asking about the css display: none then the answer is the video will still be loaded over the mobile network but it would not be visible to the end user. That being said a user could theoretically change the CSS for that element so it would display and then they could watch the video.

2
SwordW On

Video will be loaded but it is not visible to user. To pervent loading video, instead of changing css, you can remove the video from HTML using JS