LeNgHoSt的小窝

I did it my way, ‘Cause it’s my life!

2008年06月28日

自动设置IE 默认主页、自动添加到设置收藏夹、判断客户端默认主页

(1)手动设置IE 默认主页

<A class=date
onclick="this.style.behavior='url(#default#homepage)';this.setHomePage('http://blog.lenghost.cn')"
href="http://blog.lenghost.cn">
<
FONT class=abc size=2>
<
SPAN class=zhuyue>设为首页</SPAN>
<
/FONT>
<
/A>

(2)自动设置IE 默认主页

<script language="javascript">
function SetHomePage(){
 
if (document.all) {
    
document.body.style.behavior='url(#default#homepage)';
    
document.body.setHomePage('http://blog.lenghost.cn');
 
}
}
SetHomePage()//自动设置默认主页
<
/script>


(3)自动添加到设置收藏夹

<script language="javascript">
function addFavorite() {
 
window.external.addFavorite('http://blog.lenghost.cn','LuckyJan专栏');
}
addFavorite()//自动添加到设置收藏夹
<
/script>

(4)怎么样用JAVASCRIPT 判断客户端默认主页

<script language="JavaScript">
 
var WScript = new ActiveXObject("WScript.Shell");
 
var key = "HKEY_CURRENT_USER\\Software\\Microsoft\\Internet Explorer\\Main\\Start Page";
 
try {
 
var Result  = WScript.RegRead(key);
 
if((Result=="")||(Result=="about:blank"))
    
alert("当前默认主页为空!")
 
else
    
alert("当前默认主页:"+Result.toString());
 
} catch( e ) {}
<
/script>
标签:,

相关日志

发表评论