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?
- You can't because there's no return value...
- ... on browsers that support it, which I believe is just certain versions of IE, and apparently that support is sketchy ...
- ... 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.
精彩评论