How The IP Address Banning Works?
Fundamentally, no one wants to restrict his users from visiting his website but repeated violation in terms or services annoys a website and hence the end results aren’t amusing for the spammers. There are no appropriate ways of banning a Certain IP, but there are few alternatives that do the job quite effortlessly. To Ban certain IP Address we will utilize a JavaScript coding which will automatically redirect unwanted IPs to a new destination. The Script is extremely flexible because we can add unlimited IPs and can also customize the redirecting destination URL.
Whenever, a Visitor who’s IP is in the Blacklist would visit your website he will get a Message that, “Your IP address XYZ is Banned” and then, within seconds it will redirect the banned visitor to a prescribed destination URL. We have attached a screenshot below so everyone can easily understand its meaning.
How To Redirect Unwanted IP Addresses via JavaScript In Blogger?
The JavaScript file will reduce your website’s load time because in this Jquery coding, we have used modest JavaScript, no complexity involved at all. Consider the following instruction. (Remember: The same technique can be applied on any platform i.e. WordPress, Joomla and etc.).
- Go To Blogger.com >> Your Site >> Template.
- Now just Select Edit HTML >> Proceed
- Then within the template search for </head> and above it paste the Following JavaScript coding. Remember: Don’t paste this Coding in the gadget AREA i.e. HTML/JavaScript otherwise it could destroy your site maliciously. This is the reason, why it’s essential that you only add it in your Template portion rather then adding it into your Add a gadget area.
<script>
var ip = 'Your-IP-Here';
function banned(){
alert("!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!Attention!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!\nYour ip address has been banned!");
history.go(-1);
window.location.replace("http://www.mybloggerlab.com")
}
function ban(){
if (ip == "Banned-IP-1" || ip == "Banned-IP-2" || ip == "Banned-IP-3" ) {
banned();
}}ban();
</script>
- Replace Your-IP-Here with your IP Address so, the script could fetch your LocalHost. Without adding your personal IP Address, this script would stop working.
- Last but certainly not the least Replace Banned-IP-1 the IP Address that you want to ban. There is no limit for IP Banning. Therefore, we can ban unlimited IPs without any problem whatsoever.
All Done: After Add your and the victims IP Address save the Template by pressing "Save Template" Button. Now your site is safe from unwanted users.
From The Editor’s Desk:
Though, we have preciously
shared a detailed tutorial on how to Block IP Address in Blogger blog but that
tutorial allows to restrict only three IP Address. Therefore, we decided to
develop a script that could help users to ban unlimited IP Addresses. Since, we
can’t use PHP in Blogger Platform. Thus, we tried to play with JavaScript, and
it works like a charm. The script is bug free and would not provide any laggy experience.
What are your thoughts about this technique? Take a lot care till then, Peace,
Blessings and Happy Blocking.

The Editorial Team of MyBloggerLab consists of a group of Professional Blogger geeks Led by Syed Faizan Ali (Founder of MyBloggerLab).
20 comments
Well, Since this script allows to add unlimited IP Address so we can block as many users. Its not possible to ban every single spammer but it would help users to a great extent.
Thanks for waiting and leaving your comment. Peace and Blessings
There are freewares which allow you to mask your IP and browse websites using proxies.Also if you disable your browsers javascript , you can overcome this trick.All i want to say is that this method of securing your blog is very tensile and has many loopholes :( PEACE
agreed with Kapse.
You have used a very simple function in which IP's are hard coded (pre-defined).This can be workable on only few spammers who do not know technical details.
Well, in this world there are two types of people. One who are engineer like you and other a normal Guy like me. You are correct that by disabling JavaScript this script would stop working but on the same time it is better then nothing.
As you Know That, PHP can't be used on Blogger platform. Therefore, we have to utilize what we have. Hope that Helps. Peace
Sis, you're saying this because you have read this tutorial and knows that i have used JavaScript. Those who don't even know that this effect is generated from JavaScript could do much about it.
Proxy sites do Help But, We can also Include Their IPs Too. Since, it supports unlimited IPs banning.
Rather then Watching each other faces, its better to have something then nothing :).. Peace
well, most of the spammers are smart and they can use online proxies or tools to access websites. If there were any system to block comments of a particular user, like xyz@gmail.com, then it could be really useful.
Great post @syed But would you give me google search image redirect script for blogger. i want to redirect my blog images from google. i have used some scripts but when i use those scripts on my blog. they running well but my blogger editor automatic redirect. and after that i got blank page. after install this scripts i can access in my blogger editor page. I give this scrips in this link. please check it. i install this scripts this tutorial according.
http://goo.gl/OZfGY
if you have any suggestion about this scripts and have another scripts give me.
ahan, I am saying this because i know my brother will soon come up with something more efficient:-)
I won't say again n again that you are doing good.I will just point out deficiencies:p
Hopefully, I Would try to Come up with something really Great, Thanks for the Boost Up Sis.
Dude, Since The Commenting System is owned by Google. Therefore, we can't do modification because all the Data is controlled by Blogger Team. Lets hope we could do something with this issue.
Rahul I Guess We would write a Complete tutorial on it because the topic looks spicy and would surely help our Readers. Wait for few days till we develop some scripts. Peace
Hi am The Rux, very well your website to help those who need a little guidance.
On this subject because not working, the blocked ip? the (script) this goes before or later.
Aggregate to favorites friend :-)
It works pretty fine, you can even add your IP and it will block that too. Works fine!
if know it works great but because I see it work??? put my ip but I see nothing...
because?
One more thing is possible to change the scrollbar up and down...
I Think, you are not writing your IP Address correctly.Script is fab, must be only you who is facing the error.
Please, don't discuss such topics which doesn't relates the article. Peace
this method is not worth because we can easily disable all the javascripts / disable specific javascripts in the other we can edit the cookies :)
Do you know any better way? If yes then shoot it to me.
The best way is banning a masking host ( their internet connection ), because at that point they wont be able to change their IP and rejoin the site. Once you ban their internet service from your site, it wont matter how many times they change their IP. It's an old trick that IRC uses. Since these comments are old, that means blogger has changed significantly. Well I hope I was able to help.
Post a Comment
We’re eager to see your comment. However, Please Keep in mind that all comments are moderated manually by our human reviewers according to our comment policy, and all the links are nofollow. Using Keywords in the name field area is forbidden. Let’s enjoy a personal and evocative conversation.