I have tested that no error is reported in ie, but the cause is unknown. The error is reported in ie. I am working on it.
I have tested that no error is reported in ie, but the cause is unknown. The error is reported in ie. I am working on it.
Function Description:
Set the page as the homepage and add it to the favorites function. It supports ie, ff, chrome, safari, 360 security, qq, travel, and sogou browsers, incompatible with 360. Add the add-to-favorites feature in the compatible mode of quick Browser
Note:
Although it is compatible here, Some browsers do not support setting the page as a homepage using js and adding it to favorites. Users can only manually set these features in the browser or press the key, the Compatibility mentioned here refers to the js prompt when the browser has this setting.
Code:
Homepage |
Set as Homepage
| Add to favorites
// Add to favorites
Function AddFavorite (sURL, sTitle ){
SURL = encodeURI (sURL );
Try {
Window. external. addFavorite (sURL, sTitle );
} Catch (e ){
Try {
Window. sidebar. addPanel (sTitle, sURL ,"");
} Catch (e ){
Alert ("failed to add to favorites, please use Ctrl + D to add, or manually set in the browser .");
}
}
}
// Set as Homepage
Function SetHome (url ){
If (document. all ){
Document. body. style. behavior = 'url (# default # homepage )';
Document. body. setHomePage (url );
} Else {
Alert ("Hello, your browser does not support automatic page setting as the homepage function. Please manually set this page as the homepage in your browser! ");
}
}
Script