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.
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.
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.
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.
<b:if cond='data:blog.isMobileRequest == "false"'> <!--Add your script here--> </b:if>
You can watch the below video to learn more about this
You can also watch this video in Hindi
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.