Password protect content

This forum is for extensions for Joomla! version 1.0

Moderator: General Support Moderators

Forum rules
Forum Rules
Absolute Beginner's Guide to Joomla! <-- please read before posting, this means YOU.
Forum Post Assistant - If you are serious about wanting help, you will use this tool to help you post.
Joomla! Enthusiast
Joomla! Enthusiast
Posts: 224
Joined: Mon Mar 26, 2007 3:13 pm

Password protect content

Post by jgold723 » Wed Feb 17, 2010 11:41 pm

Is there a way to password protect a specific page? It doesn't matter if the user is registered or not, they'd just need the password to view the contents of the page. I've found solutions for J 1.5, but nothing for J1.0



Joomla! Fledgling
Joomla! Fledgling
Posts: 1
Joined: Wed Dec 14, 2011 1:41 am

Re: Password protect content

Post by valski295 » Wed Dec 14, 2011 2:08 am

I searched and searched and finally found a script that you can add to any page you want. There is a Plugin that I tried to use by ProgAndy called 'ContentPassword' that works, but is limited. The problem I had with it was that you can only use one password for all of your content - I didn't think that was was terribly secure. I have several ebooks that I only want my paying customers to be able to download.

I found this script on Stephen Chapman's blog, "Ask Felgall" on a page entitled, "Password Protecting a Page?"

Here's the script I'm using:

<Title> My Page to be Protected </Title>
<script type="text/javascript">
var pw =prompt('Please Enter a Password to View Protected Content: ','');
if (pw != 'XYZ') top.location = 'index.html';</script>

He offers a couple of variations so check it out and see what works for you. You can specify a password in the portion ex. (pw != 'kitty'). Now, you can have unique passwords for multiple articles. He also shows you how to password protect a URL if you want. I just inserted this script into the top of my article and a box comes up requesting the proper password.

One thing I did notice is that some additional javascript may appear after you insert this script into your article. I noticed that after I inserted this and went to test it at my webpage, the input box prompting for the password kept appearing after I entered the proper password. Just go back into your article and delete any additional javascript that appears after </head> tag in the above script. I'm using Joomla 1.5 - perhaps its just a quirk with that version. After I deleted this extra script, it works just fine.


Val Butler
Midwest Almanac



Return to “Extensions - 1.0.x”