javascript in iWeb?

Posted:
in Mac Software edited January 2014
Is there a way (preferably free) to add javascript to iWeb (v1.1.2) ? If not, perhaps somebody can assist me otherwise. Is there a way to add it using HTML? I've successfully used iWebMore to add HTML (I thought this site might help http://www.searchengineforums.com/to...cript-encrypt/), so that's why I ask. In case there's an easier completely different solution, here's the situation:



I want to password protect just a single page on my iWeb website (all this is being published on .Mac), so I did a quick search and found the following javascript code which password protects a page. I'm new to this whole web design thing so if I'm completely off on something, let me know. I'm looking for something just to deter people from accessing this page. There's no need for a totally secure way.



Here's the code:



Code:


<HEAD>

<SCRIPT language="JavaScript">

<!--hide



var password;



var pass1="test";



password=prompt('Please enter your password to view this page!',' ');



if (password==pass1)

alert('Password Correct! Click OK to enter!');

else

{

window.location="http://www.pageresource.com/jscript/jpass.htm";

}



//-->

</SCRIPT>

</HEAD>





I also found this site, though I'm not sure that it'll be of any help at all.



Any help would be great. Thanks!

Comments

  • Reply 1 of 4
    You know you can password protect iWeb sites from within the app, right? In inspector, click on the .mac logo and then password.
  • Reply 2 of 4
    Yeah, I know you can do that. That password protects the whole site though if I'm correct. If I create an entire different site, will I run into any problems? I just feel like I shouldn't have to make a completely different "site" just for one page. I'd like to be able to keep the main domain name (ex. web.mac.com/*username*/iWeb/*mainsitename*/*passwordprotectedpage*.html).



    Maybe the new site's the way to go... Regardless though, I'd like to know if I can add javascript freely in iWeb. This could, in turn, move me away from iWeb and on to search for a "better" alternative. Any suggestions in that realm would be helpful too (though it's a little off topic).
  • Reply 3 of 4
    Well, in case anyone's looking for a solution, I sort of found one. I stopped publishing my site to .mac, and I started using a different server. I just navigated to the index.html folder and edited with a simple text editor (TextWrangler) adding the javascript code I listed above. Everything works as it's supposed to now.
  • Reply 4 of 4
    And again, I have more to add...



    WIth the new iWeb from iLife '08, you can simply add javascript the same way you would using HTML snippets (added feature in '08 which is AWESOME!)



    Check out my site below to see examples (counter at the bottom of home page, comments in the blog entries)
Sign In or Register to comment.