Adding your website to favorites and setting as home page

Adding your website to favorites and setting as home page

In this article, we will look at a useful example of adding a site to Favorites and setting it as a home page.

You've probably seen links on many sites that allow you to add a site to your favorites or set it as your home page. As a rule, these actions can also be performed using the tools of the browser itself, but the visitor can forget to do this, and if you add the necessary buttons (links) on the site itself, you quietly remind him of this.

Remember, adding a site to your favorites or trying to set it as your homepage without the knowledge of the user is an extremely bad taste, so in no case try to call the example below from the onload event handler of your page.

To add a site to your favorites, use the addFavorite method of the external object. As parameters to this method, you need to pass the page address and its description. Below is a function that implements adding a site to your favorites. It can be used as a link click handler.

function addToFaavorite() {

external.addFavorite("https://sergeyem.ru", 'sergeyem.ru');

widow.alert('Спасибо, что добавили меня в избранное!');

return false;

}

 

--

 

<p><a href="http://sergeyem.ru" onclick="return addToFavorite();">Добавить в избранное</a></p>

 

To set your website as home page you can use following function:

 

function setAsHomePage(obj) {

obj.style.behavior="url(#default#homepage)";

obj.setHomePage('https://sergeyem.ru');

window.alert('Спасибо, что установили мой сайт в качестве домашней страницы!');

return false;

}

 

--

 

<p><a href="https://sergeyem.ru" onclick="return setAsHomePage(this);">Установить в качестве домашней страницы</a></p>

Popular Posts

My most popular posts

Maximum productivity on remote job
Business

Maximum productivity on remote job

I started my own business and intentionally did my best to work from anywhere in the world. Sometimes I sit with my office with a large 27-inch monitor in my apartment in Cheboksary. Sometimes I’m in the office or in some cafe in another city.

Hello! I am Sergey Emelyanov and I am hardworker
Business PHP

Hello! I am Sergey Emelyanov and I am hardworker

I am a programmer. I am an entrepreneur in my heart. I started making money from the age of 11, in the harsh 90s, handing over glassware to a local store and exchanging it for sweets. I earned so much that was enough for various snacks.

Hire Professional CRM developer for $25 per hour

I will make time for your project. Knowledge of Vtiger CRM, SuiteCRM, Laravel, and Vue.js. I offer cooperation options that will help you take advantage of external experience, optimize costs and reduce risks. Full transparency of all stages of work and accounting for time costs. Pay only development working hours after accepting the task. Accept PayPal and Payoneer payment systems. How to hire professional developer? Just fill in the form

Telegram
@sergeyem
Telephone
+4915211100235