Using Web Author to Insert Internal Bookmarks
Internal bookmarks let you jump to specific sections of a page. They are typically used when you need to:
- Jump from one end of the page to another. You see this as "Back To Top" links within long pages.
- Link to a specific location on another page. For example, you may wish to bring the visitor directly to the Discounts section located somewhere in the middle of the product's Pricing page.
Let's see how bookmarks are managed from the HTML Placeholder Control using MCMS' Web Author. Take for example, the case where you need to implement a "Back To Top" link.
Defining the Bookmark
First, we will define the bookmark (sometimes called the internal anchor point). In our example, that will be the top of the page. Somewhere at top of the page, we will specify the the spot that the visitor is brought to when he clicks on the "Back To Top" link. To specify this area in Web Author, simply highlight a space at the top of the page and click on the Insert HyperLink button on the Authoring Toolbar.
In the Web Page dialog, enter the name of the bookmark in the Define As Internal Anchor Point section. Here, we name the bookmark "Top".
Inserting the "Back To Top" Hyperlink
Next, enter the words "Back To Top" somewhere at the bottom of the page. Highlight the text and click on the Insert Hyperlink button of the Authoring toolbar again.
This time, in the Hyperlink Address field, enter "#" followed by the name of the bookmark defined earlier. e.g. #Top
To point to a bookmark that sits on another page, simply enter the URL of the page, followed by the bookmark. e.g. http://www.mysite.com/myOtherPage.htm#Top
And you're done!
Linking to Bookmarks on Framed Pages
Most of the time, this technique will work. It may not work when hyperlinking to a bookmark on another page that is framed. The hyperlink will lead the visitor to the framed page, but not to the specific bookmark. That's because the information about the bookmark does not propagate to the child pages within the frameset.
1. look at the URL of the browser's address bar
2. detect if it contains a link to a bookmark
3. if there is a bookmark, it jumps to it.
function CheckForBookmarks()This workaround ensures that bookmarks work even for framed pages where outerscript files are applied.
//check for bookmarks
var bookmark = '';
url = window.top.document.location.href;
arrUrl = url.split('#');
bookmark = arrUrl;
//jump to the bookmark
location.href='#' + bookmark;