mobile devices & code bloat

resolved (6 posts) (2 voices)

  1. suzibeau
    Member

    Hi, I'm trying to remove some elements from my mobile site to reduce code bloat. I've found this topic http://mysitemyway.com/support/topic/image_frame-shortcode-doesnt-work-at-landing-page#post-82634 in which you explain how to insert a desktop_only function and use desktop_only shortcode. Thanks - very helpful. Questions:

    1. Would this have the effect of telling the mobile browser not to "get" the files, or would it be more like using CSS to tell it not to display the files (in which case it still has to process a bunch of code)?

    2. Is there a way to manage the <head> section of the site on a mobile device. I'd like to eliminate some unnecessary style sheets and jquery calls.

    Posted 3 years ago #
  2. suzibeau
    Member

    PS. Could I use [desktop_only] shortcode in the "additional headers" window, to prevent the mobile site from fetching some of my js files?

    Posted 3 years ago #
  3. Elliott
    Support

    Hello suzibeau,

    It sounds like your wanting to hide some of the header text on mobiles correct? You can use CSS to hide the header elements, http://mysitemyway.com/docs/index.php/Customizing_the_Header.

    To hide them only on mobile devices then add the CSS in Dashboard -> your theme -> Responsive & Mobile -> Mobile CSS.

    Posted 3 years ago #
  4. suzibeau
    Member

    Thanks for your quick reply, Elliot. That info is helpful with regard to hiding or displaying page elements in the header. But what I am looking for is a way to remove links to style sheets, scripts etc, from within the head tag.

    In General Settings > Additional Headers, I see that I can add links (to style sheets, scripts etc) to the head tag. But this applies to all pages, mobile or otherwise. Is there any way to target specific pages? Or control what's in the head tag of the mobile pages?

    Posted 3 years ago #
  5. Elliott
    Support

    No, not that I know of.

    Posted 3 years ago #
  6. suzibeau
    Member

    This worked. I inserted this code in the header.php file, which has the effect of calling .js files only when needed (in the desktop version). I had to do this because of a jquery conflict between tablesorter scripts and the responsive nav menu.

    <!-- if NOT mobile, then insert tablesorter script calls (replace ' with " in HTML)-->

    <?php global $mysite; if( !isset( $mysite->mobile ) ) { echo '
    <script type="text/javascript" src="/scripts/tablesorter.js"></script>
    '; } ?>

    Posted 2 years ago #

Reply

You must log in to post.

Construct WordPress Theme
Construct wordpress theme
Myriad WordPress Theme
Myriad wordpress theme
Method WordPress Theme
Method wordpress theme
Fusion WordPress Theme
Fusion wordpress theme
Elegance WordPress Theme
Elegance wordpress theme
Echelon WordPress Theme
Echelon wordpress theme
Dejavu WordPress Theme
Dejavu wordpress theme
Modular WordPress Theme
Modular wordpress theme