View Full Version : 'Back' and 'Bookmark' Links
Ronald Ng
21st Feb 2004, 05:27 pm
How do you make a link which when clicked will take u back to the previous page? ie. same as the 'Back' button.
Also, how do you make a link which will bookmark the page?
I presume it's some javascript code?
Thanks.
David
21st Feb 2004, 06:06 pm
I'm not entirely sure that I approve of either of these methods. I tend to feel that browser functions should be left to the browser and that the user be in full control but...
The "Back" Link
The "Back" link is very simple:
</div><table border='0' align='center' width='95%' cellpadding='3' cellspacing='1'><tr><td>HTML </td></tr><tr><td id='CODE'><a href="#" onClick="history.go(-1)">Back</a>
</td></tr></table><div class='postcolor'>
The value -1 refers to the number of pages to go back in the browser history.
If you want the link to be a button, you can do this:
</div><table border='0' align='center' width='95%' cellpadding='3' cellspacing='1'><tr><td>HTML </td></tr><tr><td id='CODE'><input type=button value="Back" onClick="history.go(-1)">
</td></tr></table><div class='postcolor'>
The "Bookmark" Link
To bookmark the current page with a link, you can use this code:
</div><table border='0' align='center' width='95%' cellpadding='3' cellspacing='1'><tr><td>HTML </td></tr><tr><td id='CODE'><span style='cursor:hand;text-decoration:underline;'onclick='window.external.add Favorite(location.href,document.title);'>
Click here to add this page to your favorites</span>
</td></tr></table><div class='postcolor'>
Alternatively, if you want the link to bookmark a specific URL (for example, you can bookmark your homepage form any page on your site), use this code:
</div><table border='0' align='center' width='95%' cellpadding='3' cellspacing='1'><tr><td>HTML </td></tr><tr><td id='CODE'><a href="javascript:window.external.addFavorite('http://www.website.com','Website Title');">
Click here to add the homepage to your favorites</a>
</td></tr></table><div class='postcolor'>
vBulletin® v3.7.0, Copyright ©2000-2008, Jelsoft Enterprises Ltd.