Adding a 'Bookmark' link to Graffiti

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:

bookmarks

 

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!

permalink Permalink or Trackback Comment Comments (0) Cat Web Development
Technorati: No reaction yet!
Tags: ,
Actions: E-mail

Was this helpful?

If you liked this or found it helpful, please digg it, stumble it, buzz it, whatever it, to say thank you.





Add to Technorati Favorites

 
 If you would like to receive these posts as they happen, you can subscribe to my feed or receive my posts in your email.

Related Posts

Add comment



(Will show your Gravatar icon)  

biuquote
  • Comment
  • Preview
Loading



Check it out mango: Any links must be entered as http://www.somewhere.com with nothing touching it. Anything else will be mangled. This is to help combat spam and to also ensure the masses know of this little tidbit before they click Save comment below. :) I have this down to remind me to do something with it, but I take things slow and easy on the old horse.

Keeps her regular don't ya know, and I wouldn't want to disturb that.



CSS Template by RamblingSoul | Illinois Wine. Adapted to BlogEngine by Wayne John
EatonWeb Blog Directory  Blog Directory Blogger Forum: About Blogging for Bloggers DaniWeb - IT Professionals' Lounge Community