Add to Favorites
Encourage return visitors. This script attempts to bookmark the page programmatically and provides a helpful fallback alert for modern browsers that block this action.
Copy the Script
<script>
function addBookmark() {
var title = document.title;
var url = window.location.href;
if (window.sidebar && window.sidebar.addPanel) { // Firefox <23
window.sidebar.addPanel(title, url, "");
} else if (window.external && ('AddFavorite' in window.external)) { // IE
window.external.AddFavorite(url, title);
} else { // Chrome, Safari, Edge, Modern Firefox
alert("Press " + (navigator.userAgent.toLowerCase().indexOf('mac') != -1 ? 'Cmd' : 'Ctrl') + "+D to bookmark this page.");
}
}
</script>
<button onclick="addBookmark()">Add to Favorites</button>
Frequently Asked Questions
Modern browsers (Chrome, Firefox, Edge) have removed the ability for websites to automatically add bookmarks to prevent spam. Users must now initiate the action (usually Ctrl+D).
On mobile devices, JavaScript cannot trigger the native 'Add to Home Screen' or bookmark menu. You usually have to display a tooltip asking users to tap their browser menu.
The script includes the old `window.external.AddFavorite` command, which still functions on very old versions of Internet Explorer.