How to create add to favorites button

With this JavaScript and HTML snippet you can create a button or link on your page so that Your visitors can add your website to Favorites with a simple click.

Although today all browsers incorporate a add to favorites buttonin certain cases, and with certain sectors of users, it is very useful to guide them a little in this process, make things easier for them and encourage them to take the action we want.

with the following snippets of HTML5 and JavaScript you will create a link that will activate the spoken functionality.

Content

  • How to create add to favorites button

How to create add to favorites button

<a href="javascript:window.external.AddFavorite('http://www.srcodigofuente.com', 'Sr. Código Fuente aprende a programar hoy')">
	Pincha aquí para añadir a favoritos
</a>

Copy this code in any text editor (wysiwyg) or in any part of the bodysuit of your website and you will immediately have your button ready to use.

Remember to replace the url of https://www.srcodigofuente.com for yours and the text “Click here to add to favourites” for the one you want.

This snippet is compatible with any CMS that you use, be it WordPress, Joomla or Drupal, and it is even compatible with CMS for online stores such as Shopify, Magento or PrestaShop.

Leave a Reply