Nov 6, 2017

How to add feeling lucky widget to blogger

How to add feeling lucky widget to blogger

Hello, welcome to Guide Tricks today in this tutorial I am going to show you how to add “feeling lucky widget to blogger” this widget is very good to your blogger blog it helps to make your visitor activity in your blog by displaying good formation which is posted already on your blog.  


Also Read: How to Schedule Blog Posts for Auto Posting in Blogger


How the widgets works is, when a visitor clicks on the image display on your sidebar or any location that is placed in the blog “Are you feeling lucky” he will be automatically redirected to a random post in your blog without asking the user to choose which article did he want to read or asking for category. 


Also Read: How to Add/Remove Author or Move Blogger Blogs To Another Account


You can add this widget on your blog in a few seconds even you don’t have knowledge of coding. The step Is just go to your blog “layout” page and add the code given below into an “HTML/JavaScript” box and press the save button. 
<script type="text/javascript">
function showLucky(root) {
var feed = root.feed;
var entries = feed.entry || [];
var entry = feed.entry[0];
for (var j = 0; j < entry.link.length; ++j) {
if (entry.link[j].rel == 'alternate') {
window.location = entry.link[j].href;
}
}
}
function fetchLuck(luck) {
script = document.createElement('script');
script.src = '/feeds/posts/summary?start-index=' + luck + '&max-results=1&alt=json-in-script&callback=showLucky';
script.type = 'text/javascript';
document.getElementsByTagName('head')[0].appendChild(script);
}
function feelingLucky(root) {
var feed = root.feed;
var total = parseInt(feed.openSearch$totalResults.$t, 10);
var luckyNumber = Math.floor(Math.random() * total);
luckyNumber++;
a = document.createElement('a');
a.href = '#random';
a.rel = luckyNumber;
a.onclick = function() {
fetchLuck(this.rel);
};
a.innerHTML = 'Are you feeling lucky?';
document.getElementById('myLuckyPost').appendChild(a);
}
</script>
<script src="/feeds/posts/summary?max-results=0&alt=json-in-script&callback=feelingLucky"></script>

Also Check Out: How to Add Google Custom Search Engine to Blogger Blog



Previous Post
Next Post

post written by:

Hey! I’m Muhammad Abba Gana, popularly known as AbbaGana, a blog Scientist by mind and a passionate blogger by heart fountainhead of Guidetricks, Duniyan Fasaha, Duniyar Yau, Hanyantsirah, Gidan Novels, Abba Gana Novels and Be With Me Technology, I am twenty something year old guy from Jimeta, Adamawa State, Nigeria. I’m a Freelance writer, Information marketer, professional blogger, Web designer, Internet speaker, software Developer and also an author. I make living with my laptop and can work from anywhere I find myself (as long as there is a power supply and a reliable internet connection).

0 comments:

We Cherish Your Comments Most, Kindly Drop your comments below. Don't forget to click "Notify Me" to know if we have responded to your comments, Thank You.