One of the ‘perks’ of having a mobileMe account apart from being able to put comments on your iWeb blog is the ability to password protect some or all of your iWeb pages. Okay so the password protection isn’t ‘super secure’ but if you want that you will have to get yourself a HTTPS site.
This iWeb tutorial does involve a little bit of editing of the code of your iWeb site, but not very much. In fact all you have to do is paste in some code and that is it.
One further restriction is the password. You can only have one, which is set by you. Once again we are not talking the type of security you would expect from your on-line bank account, just something that would deter the casual visitor to your site.
In order to get this whole process working you will need an iWeb site with at least 2 pages. The first should have a link to the second page (this can be using the default nav-bar or a normal text link). What we will then do is add a bit of code the second page which says (in a nutshell) that page 2 is protected and a user must enter a password first before they can view it. If the password is correct then the visitor will be taken to page 2, if not then they will be left on page 1 (or any page that you nominate).
Sounds like the sort of thing that you need? Well let’s crack on. You will need your site either published to a folder or on a MobileMe server.
In Finder navigate (either on your hard-drive or iDisk) to the page you want to protect and open it in your favorite HTML editor (TextWrangler, BBEdit, Dashcode etc….)
You will now need to scroll down to the bottom of the ‘Head’ section of the page indicated by the </head> bit of code.
Now all you have to do is paste in the code that you will find below above the end of the ‘Head’ section and, if you so wish, edit it to fit in with your iWeb site.
There are various parts of the code that you can edit; the password of course, as well as the message that appears when a user tries to access the page, the message that appears when the password is successful and also the location of a ‘fail page’ which can either be the same page they started on or as I mentioned earlier a completely different page altogether.
And here is the code, I’ve highlighted the changeable bits in red.
password=prompt('This page is protected. Please enter the password to view this page!',' ');
alert('The Password is correct! Please click OK to enter the gallery!');
And this is what it will look like when someone visits your site and clicks on the link to the protected page:
and when they enter the correct password they will then get this message:
That’s all there is to it. If you have published to a folder just upload your site via FTP and if you have edited your site on your iDisk then just save the changes and you’re done.
And there we have it. Password protected web-sites without MobileMe. Enjoy.