0

I want to add an "Add To Favorites" button on the sidebar of my blog in Blogger. I already have the image but I need the code. I'd like it to work for all browsers. What will you suggest to me?

Brock Adams
  • 90,639
  • 22
  • 233
  • 295
  • possible duplicate of [Add to browser favorites/bookmarks from javascript but for all browsers (mine doesn't work in CHROME)?](http://stackoverflow.com/questions/992844/add-to-browser-favorites-bookmarks-from-javascript-but-for-all-browsers-mine-do) – Brock Adams Sep 07 '14 at 00:43

1 Answers1

0

First of all I think it works for Explorer not sure for the rest.

You can add an Image widget, so that you can upload the image you want without any problem.

Once you have chosen the image, the only thing is that in the blogger widget options you can state a URL linked to this image, but not what you really want, the link to the function "Add to favorites". In order to do this, first of all you have to introduce any URL in the link field. Don't worry about which URL, it wont be used.

Before modifying the code, save a backup copy.

Once done, go to "Template" -> "Edit HTML" and look for the image widget, in order to locate it look for:

<b:widget id='Image1' locked='false' title='' type='Image'>

Once located, go to the following section inside the widget tag

<b:includable id='main'>
<b:if cond='data:title != &quot;&quot;'>
  <h2><data:title/></h2>
</b:if>
<div class='widget-content'>
  <b:if cond='data:link != &quot;&quot;'>

And change this line (that would be the information of the URL associated with the image previously in blogger):

 <a expr:href='data:link'>

by this one that links the image to "Add to Favorites":

    <a href='javascript:window.external.AddFavorite(&apos;YOUR-BLOG-URL&apos;, &apos;TEXT-TO-APPEAR&apos;)'>

where you should sustitute YOUR-BLOG-URL by the URL of your blog (http://nameofyourblog.blogspot.com) and TEXT-TO-APPEAR by the text that would be seen in the dialog box when adding to favorites.