wayne on March 25, 2008
Since the release of Graffiti this month, I've found time to delve into the application and begin a new project for myself. This project is another blog where it will simply regurgitate existing information from various sources and have plenty of dressing around it.
Since it's a blog, I want users to be able to bookmark the site from a simple link in the header titled 'Bookmark'. When they click this link, the browser default Bookmark dialog will display. It's simple to do and the user probably understands how to use the Add Favorite dialog already. This quickly describes how to do this within Graffiti.
This is the standard IE Add Favorite dialog:
First thing we need to do is add a menu item. We are going to add this to the main header navigation, so within the Graffiti site administration, we need to go to Presentation - Navigation and once there, find the Custom Links tab. I used 'Bookmark' as my text value, but for the link value we are going to add some javascript instead of a standard URL it probably expects.
In the Link textbox, enter the following value:
javascript:bookmarksite('My New Site!','');
At this point this will only generate some errors for you, we need to define the bookmarksite function and include it in every page of the site. We can do that by adding the following <script> to the Site Options - Settings Header textbox. Add the following script to the header textbox:
<script xmlns="" type="text/javascript">
function bookmarksite(title, url){
url = top.location.href;
if (document.all)
window.external.AddFavorite(url, title);
else if (window.sidebar)
window.sidebar.addPanel(title, url, "")
}
</script>
This should be considered a hack I guess as I'm not fully familiar with Graffiti just yet, but it works well enough so far for me. If you know of other ways or perhaps a better way, please let me know!
It is nice to see how easy this was to accomplish. Thankfully Graffiti allows a place to inject some custom javascript code into the page header.
Cheers!