Old Toad's Tutorials
No. iW07
Add a Link to the Navbar Without Adding a Page to the Site
 
Old Toad's Tutorials
This tutorial describes how to add a hyperlink to the iWeb generated navbar without having to create a page.

1 - add an HTML snippet to the web page.

2 - enter the following script in the snippet:

<script language="JavaScript" type="text/javascript">
<!--
theNavUL = parent.document.getElementById('widget0-navbar-list');
theLiVar = '<li class="noncurrent-page"><a href="URL TO OTHER SITE OR FILE">Link Title</></li>';
// At the beginning
theNavUL.innerHTML = theLiVar + theNavUL.innerHTML;
// At the end
theNavUL.innerHTML += theLiVar;
// -->
</script>
3 - the link will not be displayed until the site is published online. Be sure to provide adequate room at the end of the navbar, i.e. the confining box, so the navbar does not wrap unexpectedly.

4 - the link will appear only on the page that the snippet was added to. See the navbar above for a link titled “PL” for page-less link. It will link to the first page of this tutorial site.

This script is far easier than adding a blank page and using java redirect script in an HTML snippet and creates fewer pages to be uploaded and read by browsers.

Thanks to Wyodor for the script from this iWeb topic: Can you link to another website in iWeb?

No warranty expressed or implied, etc.
© 2011 Old Toad