Subscribe For Free Updates!

We'll not spam mate! We promise.

Monday, 22 April 2013

How To Ban Unlimited IP Address with JavaScript in Blogger

At this time and age are tons of hackers in the blogosphere, turns with only a motive to hack as many websites as possible. Therefore to protect my blog from brute force attacks or kidnapping it is essential, a high level of security system to have. There is no doubt that bloggers platform has the indestructible security if I compare it with one of the leading blogging platform of WordPress. Since blogger sites work enabled on Google's server, so it is extremely difficult to hack or abducts her. But sometimes to comment on content cloning on bombing and spam is the biggest pain. In this situation, a person attempts to find the perpetrators and restrict access his website. In other words, we can say that a ban on its IP address.

How The IP Address Banning Works?

Basically nobody wants to prevent its users breach in terms repeated visiting his website but or a website interferes with services and therefore the results are not amusing for the spammers. There is no corresponding to prohibit a specific IP address, but there are some alternatives, which is quite easily to get the job done. I use a JavaScript encoding unwanted IPs are automatically redirected to a new destination to ban particular IP address. The script is very flexible because we can add unlimited IPs and can customize the destination URL conductive to.

When a visitor, the IP is in the is black list would visit your website, he received a message that "banned your IP address which is XYZ!" and within seconds it will redirect then, banned visitors to a predefined target URL. I've included a screenshot below, so that everyone can easily understand its importance.

How To Redirect Unwanted IP Addresses via JavaScript In Blogger?

The JavaScript file will reduce your website load time, because in this jQuery coding, I humble JavaScript, involved have ever used any complexity. Consider the following statement. (Keep in mind: the same technique can be applied on any platform such as WordPress, Joomla and etc.).
  • Go To > Your Site > Template.
  • Now just Select Edit HTML > Proceed
Hen inside the template search after</head> and before it, add the following JavaScript code. Keep in mind: not this coding paste in the gadget area i.e. HTML/JavaScript otherwise could destroy your site in bad faith. This is the reason why it is necessary, that you rather then add it in your template part in it add a gadget area Add.

var ip = ‘Your-IP-Here‘;
function banned(){
alert(“!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!Attention!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!\nYour ip address has been banned!”);
function ban(){
if (ip == “Banned-IP-1” || ip == “Banned-IP-2” || ip == “Banned-IP-3” ) {

Replace your-IP-here with your IP address the script could your "localhost" so obtained. Without your personal IP address add this script would no longer work.
But certainly not the least replace last banned-IP-1 which IP address you want to block. There is no limit for the ban by IP. Therefore, we can ban unlimited IPs without any problems whatsoever.

All done: after your victims IP address add and save the template "Save template" button. Now, your site is secure from unwanted users.

I decided to develop a script, allowing users to prohibit unlimited IP addresses. Since we can use not PHP blogger platform. So, I tried to play with JavaScript, and it works like a charm. Would the script is accurate and not laggy experience. What are your thoughts about this technique? Make a lot until then, peace, blessings and happy block. 

Please Give Us Your 1 Minute In Sharing This Post!
Powered By: BloggerYard.Com


  1. The Pakistan's first verified and certified PTC site, If you want to earn money online by sitting at your home then register your account now and earn in Pak Rupees daily.

  2. Web Design Company USA

    Nice and very interesting blog. Very good piece of content. Thanks for sharing this post.

  3. Do you know the Best sites on earth, very nice post, thanks to share....