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

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

 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. 

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 find 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 the 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 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>

You can watch the below video to learn more about this

YouTube video

Conclusion

I hope this article helps you load Blogger widgets or scripts only on desktop or only on 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 on our Telegram Channel or other social media handles. Thank you.

Leave a Reply

Your email address will not be published. Required fields are marked *