Forums

The forums ran from 2008-2020 and are now closed and viewable here as an archive.

Home Forums Other Prevent hidden html from loading on mobile

  • This topic is empty.
Viewing 7 posts - 1 through 7 (of 7 total)
  • Author
    Posts
  • #44442
    eaps99
    Member

    It is possible and worth preventing html to be loaded on mobile, if it will not be displayed? Something like media queries for html.
    The only solution i found, other than “do not load images” solutions, was [this one](https://github.com/Podders/Jquery-Media-Comments “jquery media comments”), but it’s realy recent.

    #133562
    Anonymous
    Inactive

    it’s easier to create a mobile version of your site entirely. and have users redirect if on mobile to the mobile version.

    #133565

    Seems you’re talking about a responsive based design. You can take a look at Chris’ last post on setting a cookie to check client side information, then adjust what content gets displayed server side. Or, like Jarolin said, you could keep your site responsive, but also UA sniff to serve a completely different mobile site when appropriate.

    #133581
    eaps99
    Member

    It’s an option, but I don’t want to go that far.
    Sometimes we have a few elements in a responsive website we don’t want to show in the mobile version. Usually, people just set display:none, or something with the same result, to hide it. The problem with this solution is that these elemets will be loaded and slow the website.
    That’s why I was wondering on solution to say “if @media (min-width: 321px) show this block of html, else don’t. Something like [IE Conditional Statements](https://css-tricks.com/how-to-create-an-ie-only-stylesheet/ “IE Coonditional Statements”), for instance.

    #133572
    darrylm
    Member

    Perhaps tackle the problem with JavaScript width detection and AJAX?

    #133643
    croydon86
    Participant

    Google conditional loading.

    Its pretty much having the content on another page somewhere on your server, and then bring it in using the .load function with jQuery.

    #133649
    Anonymous
    Inactive

    you can add display:none to the elements you want to hide when the window size reaches a certain size. The HTML element will be loaded but it would act as if it weren’t even there.

Viewing 7 posts - 1 through 7 (of 7 total)
  • The forum ‘Other’ is closed to new topics and replies.