I would like to load javascript files only on Desktop version of my Google blogspot (blogger.com) since I need a light version of my blog for mobile.
I came through followings, but not working
<b:if cond != 'data:blog.isMobile'>;
<b:if cond = !'data:blog.isMobile'>;
<b:if cond = '!data:blog.isMobile'>;
<b:if cond='data:blog.pageType !== "data:blog.isMobile">
How can I write "is Not Mobile" conditional in Google blogspot? Thanks in advance for all answers.
================================================================================
Update: I'm using following code at the moment and it's working but better ideas are welcome
<b:if cond='data:blog.isMobile'>
<b:else/>
//I include javascript files here and they only appear on desktop version
</b:if>
You can use true
or false
statements in blogger conditional tags in this case.
This is the best way ;)
<b:if cond='data:blog.isMobile == "false"'>
//Contents inside this, will only appear in Desktop version.
</b:if>
Edit #1:
This will work only if you have enabled mobile template, and set it to custom.
And it does work on Chrome's mobile emulator. (will be redirected to mobile version if visiting from a mobile device or with an emulator that reflects a mobile Browser User Agent. it will add ?m=1
at the end of the URL)
Hope this helps.
i've found a useful conditional tag to display only on mobile view recently. this conditional tag worked even i didn't activate mobile template.
<b:if cond='data:blog.isMobileRequest == "true"'>
<!-- showed only if browser request as a mobile -->
<b:else/>
<!-- showed if browser not requesting as a mobile device-->
</b:if>
Try use this with my example: in this example, thumbnail image removed when mobile request value is true and displaying thumbnail if not requested.
<b:if cond='data:blog.isMobileRequest == "true"'>
<div>
<div class='item-title'><a expr:href='data:post.href' expr:title='data:post.snippet'><data:post.title/></a></div>
</div>
<b:else/>
<div class='item-thumbnail-only'>
<b:if cond='data:post.thumbnail'>
<div class='item-thumbnail'>
<a expr:href='data:post.href' expr:title='data:post.snippet' target='_blank'>
<img border='0' expr:alt='data:post.title' expr:height='data:thumbnailSize' expr:src='data:post.thumbnail' expr:width='data:thumbnailSize'/>
</a>
</div>
</b:if>
<div class='item-title'><a expr:href='data:post.href' expr:title='data:post.snippet'><data:post.title/></a></div>
</div>
</b:if>
you can find this conditional tag value in view-source of your blogspot page.
data:blog.isMobileRequest is a condition wich listening value of m= query on address bar.
web address followed with m=1 it mean isMobileRequest: true;
image 1
and if not followed with m=1 or followed with m=0 it mean isMobileRequest: false;
image 2
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With