Translate This Blog
Remember To Always Back Up Your Template Before Attempting Any Of The Tweaks On This Site

Add Content Warning to Single Post.

 Before using this script please read everything below.

Blogger has a default content warning that will make visitors confirm before entering your blog. If this setting is applied it will be set to every post in your blog. Sometimes you may only have a single post with adult content which seems pointless to add the content warning to every page making you lose traffic because of it. Well with this script below you can avoid that problem.

This does not negate the rules of Blogger to enforce the content warning. In other words even if you add this script to your post it does not mean Blogger wont enforce a content warning on your blog anyways. This is not a replacement for the Blogger content warning and if you use this script you do so at your own risk. If Blogger does enforce the content warning on your blog then you will not be able to remove it on your own. To remove it you will have to go through the Blogger Help Forums after you have removed the post containing the mature content.

Their are a few ways you can do this but none of them are full proof. For an example this will not work for users who have JavaScript disabled. Also in order for this script to work the page must be loaded so they will still have a gleams of the adult content before the script it activated.

To use this script its best that you do not put this post on your homepage. You should change the post dates so this post will not display on your homepage. Otherwise this script will display when your homepage is loaded which is bad because it will be a endless loop because the script will activate again when the  homepage is loaded.

To add this script to your blog just paste this script into your post in Edit HTML mode.

<script type="text/javascript">
{
var r=confirm("The page you are about to view may contain content only suitable for adults. Press Ok to continue or Cancel to be redirected to the homepage.");
if (r==false)
  {
  document.location.href="PAGE TO BE REDIRECTED TO";
  }

}
</script>
You can edit the red text so the message displayed is different if need be.
The orange text is the link or page your visitors will be directed to if they select cancel. You can even make a custom page for them to be directed to if need be.

2 comments:

Noname said...

This is good, except for the endless loop on the homepage. But, can we overcome it with b:if condition ?

AiresOFwar said...

No conditional tags will not stop a script from loading. As I said above if you do use this on one of your post then you should change the post date of the post so it does not show up on your homepage.

Post a Comment

Please don't post hyperlinked text within the comment box! It will not be published and you will be marked as spam.

Web Design Blogs PageRank