Compatible Firefox firefox, ie6/ie7/ie8 add favorites, set as homepage code

Source: Internet
Author: User

Once upon a time, used to join the collection code, but not compatible with Firefox, a bit depressed, at this point, there is a compatible version of the Code, published as follows:
Compatible with Firefox (version: Firefox 3.6.3), Ie6/ie7/ie8 to join the collection code, online some test time did not pass, the following no problem.

<script>
Get URL address favorites compatible FF
function Shoucang (title,geturl) {
Title=document.title;
Geturl=document.location.href;
if (document.all) {
Window.external.addFavorite (Geturl,title);
}
else if
(Window.sidebar)
{
Window.sidebar.addPanel (Title, Geturl, "");
}
}
</script>



Reference
', ' news-<%=id%> HTML '); />



or direct reference (remove//comment in function to take the initiative to get the address)




Set homepage, compatible with Firefox is more difficult here is Tencent QQ set as the homepage code, you can refer to, most of the can only do this look

<script>
function Sethome (OBJ,VRL) {
try{
Obj.style.behavior= ' url (#default #homepage) '; Obj.sethomepage (VRL);
}
catch (e) {
if (Window.netscape) {
try {
Netscape.security.PrivilegeManager.enablePrivilege ("Universalxpconnect");
}
catch (E)
{
Alert ("Sorry.") Your browser does not support setting the homepage directly. Please enter "About:config" in the browser address bar and return to the [Signed.applets.codebase_principal_support] set to "true", click "Add Favorites" and ignore the security prompts to set success. ");
}
var prefs = components.classes[' @mozilla. Org/preferences-service;1 '].getservice ( Components.interfaces.nsIPrefBranch);
Prefs.setcharpref (' Browser.startup.homepage ', VRL);
}
}
}
</script>

<a href= "javascript:void (0)" onclick= "Sethome (this,window.location)" target= "_top" > Set as Homepage </a>

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.