开发者

how to detect if user click no or yes on window default alert?

开发者 https://www.devze.com 2023-03-10 03:09 出处:网络
I wrote the fol开发者_运维问答lowing code to set the site as the homepage: document.body.style.behavior=\'url(#default#homepage)\';

I wrote the fol开发者_运维问答lowing code to set the site as the homepage:

document.body.style.behavior='url(#default#homepage)';
document.body.setHomePage('http://www.abc.com');

When the user clicks this, an alert box appears asking the user whether or not he wants to set the site as his homepage.

How can I detect which choice the user made?


  1. You can't because there's no return value...
  2. ... on browsers that support it, which I believe is just certain versions of IE, and apparently that support is sketchy ...
  3. ... but you really shouldn't, because it's extremely annoying when a site asks a user that (the answer is almost always no).


Use isHomepage to check if it is the homepage. If so, the user pressed yes.

0

精彩评论

暂无评论...
验证码 换一张
取 消