javascript创建类

    技术2022-07-11  149

    javascript创建类

    The unfortunate part about creating websites for customers is that no matter what recommendation I make, if they want it, I have to give it. Thus is the case with recently adding a "Set As Homepage" link to a customer's website. Homepages are much more useful to the user when they're set to Google, Yahoo!, another portal, or they're webmail. To each their own, I guess, so here's how you create a "Set As Hompage" link using JavaScript.

    为客户创建网站的不幸之处在于,无论我提出什么建议,如果他们愿意,我都必须给出建议。 最近在客户网站上添加“设为首页”链接就是这种情况。 将主页设置为Google,Yahoo !、另一个门户网站或将其设置为Webmail时,对于用户而言,其功能更加有用。 我猜,对于每个人来说,这就是使用JavaScript创建“设为首页”链接的方法。

    JavaScript (The JavaScript)

    function set_homepage() { document.body.style.behavior='url(#default#homepage)'; document.body.setHomePage('https://davidwalsh.name'); }

    I don't want to say that this link is tacky necessarily, but I think it's a bit obnoxious. If the user wanted your site to be their homepage, you wouldn't have to ask them. Also note that this only works in Internet Explorer.

    我不想说这个链接一定是俗气的,但是我认为这有点令人讨厌。 如果用户希望您的网站成为他们的主页,则无需询问他们。 另请注意,这仅在Internet Explorer中有效。

    翻译自: https://davidwalsh.name/javascript-set-homepage-link

    javascript创建类

    Processed: 0.016, SQL: 9