How to put a widget on blogger web layout that to be displayed only on mobile version a blogger / blogspot website?
Here are the steps for adding a custome widget to blogger site layout which is to be shown only on Mobile version of the blogger web page. Please make sure that you take a copy of Blogger template code before editing it.
Step1: Go to Admin area of your Blogger (Blogspot) website
Step2: Open the Layout of your blog
Step3: Click on "Add a Gadget" to add a new Gadget of type "HTML/JavaScript"
-- Enter a Title to identify your new gadget
-- Enter gadget content in the "Content" box
-- Save the widget
Step4: Now take the Template section of the blog and click on "Edit template" button
Step5: Search for the text you given as the title for your new Gadget, You can find your new gadget code similar to the one given below:
please note : the text "YOUR_NEW_GADGET_TITLE" will be your gadget title.
Step6: Add the attribute mobile='only' to the "b:widget" tag, like the one given below
if you dont want to display your gadget name to the user, then change the code like this:
Step7: Save template and check the Layout page. You will not be able to see your new gadget there.
Step8: Now take your blog on browser in the mobile mode ie, http://www.yourblogname.blogspot.com/?m=1
ANOTHER OPTION
Another option to display mobile specific contents is to use the Blogger IF condition statement.
Here you will check blogger variable "data:blog.isMobile". if it is "true", then site is in mobile mode.
If you want to place Javascript Codes ( like Adsense code or FB plugin codes) inside the blogger conditional statement, then you have to escape the JS script by using an HTMl escape tool.
Now take the Template section of the blog and click on "Edit template" button. Put the code in the area where you wish to show the new mobile specific gadget content.
Related Topics
Here are the steps for adding a custome widget to blogger site layout which is to be shown only on Mobile version of the blogger web page. Please make sure that you take a copy of Blogger template code before editing it.
Step1: Go to Admin area of your Blogger (Blogspot) website
Step2: Open the Layout of your blog
Step3: Click on "Add a Gadget" to add a new Gadget of type "HTML/JavaScript"
-- Enter a Title to identify your new gadget
-- Enter gadget content in the "Content" box
-- Save the widget
Step4: Now take the Template section of the blog and click on "Edit template" button
Step5: Search for the text you given as the title for your new Gadget, You can find your new gadget code similar to the one given below:
<b:widget id='HTML1' locked='false' title='YOUR_NEW_GADGET_TITLE' type='HTML'>
<b:includable id='main'>
<!-- only display title if it's non-empty -->
<b:if cond='data:title != ""'>
<h2 class='title'><data:title/></h2>
</b:if>
<b:if cond='data:blog.pageType == "index"'>
<div class='widget-content'>
<data:content/>
</div>
</b:if>
<b:include name='quickedit'/>
</b:includable>
</b:widget>
<b:includable id='main'>
<!-- only display title if it's non-empty -->
<b:if cond='data:title != ""'>
<h2 class='title'><data:title/></h2>
</b:if>
<b:if cond='data:blog.pageType == "index"'>
<div class='widget-content'>
<data:content/>
</div>
</b:if>
<b:include name='quickedit'/>
</b:includable>
</b:widget>
please note : the text "YOUR_NEW_GADGET_TITLE" will be your gadget title.
Step6: Add the attribute mobile='only' to the "b:widget" tag, like the one given below
<b:widget id='HTML1' locked='false' mobile='only' title='YOUR_NEW_GADGET_TITLE' type='HTML'>
<b:includable id='main'>
<!-- only display title if it's non-empty -->
<b:if cond='data:title != ""'>
<h2 class='title'><data:title/></h2>
</b:if>
<b:if cond='data:blog.pageType == "index"'>
<div class='widget-content'>
<data:content/>
</div>
</b:if>
<b:include name='quickedit'/>
</b:includable>
</b:widget>
<b:includable id='main'>
<!-- only display title if it's non-empty -->
<b:if cond='data:title != ""'>
<h2 class='title'><data:title/></h2>
</b:if>
<b:if cond='data:blog.pageType == "index"'>
<div class='widget-content'>
<data:content/>
</div>
</b:if>
<b:include name='quickedit'/>
</b:includable>
</b:widget>
if you dont want to display your gadget name to the user, then change the code like this:
<b:widget id='HTML1' locked='false' mobile='only' title='YOUR_NEW_GADGET_TITLE' type='HTML'>
<b:includable id='main'>
<!-- only display title if it's non-empty
<b:if cond='data:title != ""'>
<h2 class='title'><data:title/></h2>
</b:if>
-->
<b:if cond='data:blog.pageType == "index"'>
<div class='widget-content'>
<data:content/>
</div>
</b:if>
<b:include name='quickedit'/>
</b:includable>
</b:widget>
<b:includable id='main'>
<!-- only display title if it's non-empty
<b:if cond='data:title != ""'>
<h2 class='title'><data:title/></h2>
</b:if>
-->
<b:if cond='data:blog.pageType == "index"'>
<div class='widget-content'>
<data:content/>
</div>
</b:if>
<b:include name='quickedit'/>
</b:includable>
</b:widget>
Step7: Save template and check the Layout page. You will not be able to see your new gadget there.
Step8: Now take your blog on browser in the mobile mode ie, http://www.yourblogname.blogspot.com/?m=1
ANOTHER OPTION
Another option to display mobile specific contents is to use the Blogger IF condition statement.
Here you will check blogger variable "data:blog.isMobile". if it is "true", then site is in mobile mode.
If you want to place Javascript Codes ( like Adsense code or FB plugin codes) inside the blogger conditional statement, then you have to escape the JS script by using an HTMl escape tool.
<b:if cond='data:blog.isMobile'>
----------
----------
----------
Your code comes here
----------
----------
----------
</b:if>
----------
----------
----------
Your code comes here
----------
----------
----------
</b:if>
Now take the Template section of the blog and click on "Edit template" button. Put the code in the area where you wish to show the new mobile specific gadget content.
Related Topics
- How to put Adsense code after a particular post on a blogger website's home page
- What is the Label specific post feed of a blogger website and how to display the blogger posts based on a particular Label or category?
- Find the Sitemap url of a Blogger or Blogspot website
- Display blogger Post based on a category or label
- Why BLOGSPOT website redirects to a country specific domain and How to view blogger website in blogspot.com domain?
- Click here for more Blogger Tips