Blog is under maintenance mode. Test link

How to Load widgets or Script only in desktop or mobile devices in Blogger

 In this article, I will show you how you can load the Blogger widgets or scripts only on Desktop or Mobile devices. 

Suppose you want to display an ad in the sidebar only for Desktop users and don't want that ad on mobile devices then you can do that by using a Blogger conditional Tag

It helps you fine-tune your website loading and improve Blogger loading speed by blocking unnecessary codes from being loaded on mobile or desktop devices. 

How to load Blogger widgets or Scripts only on Mobile or Desktop

So, let's check how you can do that.

Load the Blogger Widget only on Mobile Devices

For this, you need to copy the widget title and find that widget in the theme file by searching (CTRL + F ). 

Once you found the widget you need to add the below conditional tag just before the widget Id as shown in the below image.

Blogger conditional tag for loading widget only on mobile
cond='data:blog.isMobileRequest'

Load Blogger widget only on Desktop devices

In the same way, if you want to load the widget only on desktop and not on mobile devices then you can use the below code.

cond='not data:blog.isMobileRequest'

Load Blogger Script or Codes on Desktop or Mobile only

You can also load any particular scripts or HTML, or CSS codes on particular devices like only on a desktop or only on a mobile device by using Blogger If conditions.

For Loading script only in Mobile use the below conditional tag. Just wrap the code with the if condition.

<b:if cond='data:blog.isMobileRequest == "true"'> <!--Add your script here--> </b:if>

For Loading Blogger script only in Desktop use the below conditional tag.

Blogger if condition for loading only in desktop
<b:if cond='data:blog.isMobileRequest == "false"'> <!--Add your script here--> </b:if>

Conclusion

I hope this article help you load Blogger widget or scripts only in desktop or only in Mobile devices

In this way you can speed up your Blogger loading Speed by optimizing the loading of code device specific.

If you have any doubts regarding this you can ask us in our Telegram Channel or other social media handles. Thank you.

Choose Language
Content Creator, Blogger, Front-end Developer
Bookmark This Blogger: 😌

Post a Comment

Cookies Consent

This website uses cookies to offer you a better Browsing Experience. By using our website, You agree to the use of Cookies

Learn More