关于页面被拦截

先来看一下几个常用浏览器的拦截设置

  1.  ie 

 

           

              

     2.   TT

                 

 

     3.  maxthon

                                  

  

 chrome , firefox 默认安装是没有页面拦截的, 都有一些对应的插件

 

测试的时候不能在本地测试, 要把页面放到http 服务器上。 

1.   ie  

页面拦截设为高, 所有方式都无法在新页打开。

拦截设为中,   window.open , 直接写的页面上, new 一个a click,以及form submit  都可以打开页面, timeout 不能打开页面。

拦截设为低, 以上几种方式都可以打开。 

  

ie6 submit 方式后会在url 后加上 ?  如http://www.baidu.com/? 

 

2.   maxthon 

不继承ie的拦截设置。

maxthon 支持一定时间的timeout open ,  现在测试大概是850 ms, 以上几种方式在timeour 大于850 不能打开页面。

 

3. chrome

chrome不支持timeout open 的方式, 跟ie 的一致。

 

4.  TT 

TT 自定义屏幕模式下不能用脚本打开新页面。

 

5.   firefox  

firefox 默认的方式没有拦截, 以上方式都可以打开。 

 

ExpandedBlockStart.gif 代码
<! DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd" >
< html  xmlns ="http://www.w3.org/1999/xhtml" >
< head >
< meta  http-equiv ="Content-Type"  content ="text/html; charset=gb2312"   />
< title > title </ title >
< style  type ="text/css" >

    a  {
        display :  block ;
        margin  :   10px  0 ;
        border :  2px solid #555 ;
        width :  500px ;
    
}
</ style >
< script  type ="text/javascript" >

//  chrome, maxthon 不拦截  ie拦截水平 '中' 会拦截
function  test0() {
        window.open( ' http://www.baidu.com ' );
}

function  test_10() {
    setTimeout( function () {
        window.open( ' http://www.baidu.com ' );
    }
    ,  10 );
}

function  test_local_100() {
    setTimeout( function () {
        window.open( ' http:// '   +  location.host);
    }
    ,  100 );
}

function  test_local() {
    window.open( ' http:// '   +  location.host);
}

//  maxthon 不拦截  ie拦截水平 '中' 会拦截
function  test() {
    setTimeout( function () {
        window.open( ' http://www.baidu.com ' );
    }
    ,  500 );
}

//  maxthon 不拦截  ie拦截水平 '中' 会拦截
function  test1() {
    setTimeout( function () {
        window.open( ' http://www.baidu.com ' );
    }
    ,  850 );
}

//  maxthon 拦截  ie拦截水平 '中' 会拦截
function  test2() {
    setTimeout( function () {
        window.open( ' http://www.baidu.com ' );
    }
    ,  900 );
}

//  maxthon 拦截 ie拦截水平 '中' 会拦截
function  test3() {
    setTimeout( function () {
        window.open( ' http://www.baidu.com ' );
    }
    ,  1000 );
}

//  以上几个在chrome 下拦截
//

//  maxthon 不拦截 ie拦截水平 '高' 会拦截, firefox , chrome 不支持
function  test4() {
    
var  a  =  document.createElement( ' a ' );
    a.href  =   " http://www.baidu.com/ " ;
    a.target = " _blank " ;
    document.body.appendChild(a);
    a.click();
}

function  test_ope() {
    
var  a  =  document.getElementsByTagName( ' a ' );
    
for  ( var  i  =   0 , len = 10000 ; i  <  len; i ++ ) {
        
for  ( var  j  =   0 , len = a.length; j  <  len; j ++ ) {
            
1
        }
    }
    window.open( ' http://www.baidu.com ' );
    window.open( ' http://www.baidu.com ' );
}

//  
</ script >
</ head >
  
< onclick ="test0()" > window.open </ a >
  
< onclick ="test()" > timeout 500ms window.open </ a >
  
< onclick ="test1()" > timeout 850ms window.open </ a >
  
< onclick ="test2()" > timeout 900ms window.open </ a >
  
< onclick ="test3()" > timeout 1000ms window.open </ a >
  
< onclick ="test4()" > new a click </ a >

  
< onclick ="test_10()" > timeout 10ms window.open </ a >
  
< onclick ="test_local()" >  window.open local domain </ a >
  
< onclick ="test_local_100()" > timeout 100ms window.open local domain </ a >

  
< onclick ="test_ope()" > test operation open </ a >

  
<!-- 都不拦截 -->
  
< href ="http://www.baidu.com/"  target ="_blank" > a href target blank </ a >
  
< href ="http://127.0.0.1/"  target ="_blank" > a href target blank local domain </ a >

  
< div  onclick ="test()" > div time 500 </ div >
  
< button  onclick ="test()" > button time 500 </ button >
  img time out 500
  
< img  src ="http://www.baidu.com/img/baidu_logo.gif"  onclick ="test()"   />

  
  
<!-- firefox,  maxthon下测试ok, ie下测试在本页打开可以就是说不设target, 或者target= "" , 新页面打开在ie 的拦截设为高不行 chrome,下弹出一次, 关掉那个页面, 再点就没有反映了 -->
  
  
< form  action ="http://www.baidu.com"  target ="xxx"  method ="get"  accept-charset ="utf-8" >
      form submit
  
< p >< input  type ="submit"  value ="Continue &rarr;"   /></ p >
  
</ form >

< body >

</ body >
</ html >

   

 

 小结一下:

1.   应用要在新页打开,使用 a 加上 href 把别的一些功能放在onclick 上, 如

<href="http://www.baidu.com" target="_blank" onclick="alert(1)"></a>

 

 2.  一些应用要在新页打开,跟cgi在关的, 可以使用http 302 跳转

 <href="http://www.example.com/cgi?myid=1" target="_blank" onclick="alert(1)"></a>

       http://www.example.com/cgi?myid=1  将跳转到你想要的页面

 3.  一定要用js在新页打开页面的, 用window.open 就可以

< href ="javascript;"  onclick ="window.open('http://www.baidu.com');return false;" ></ a >

 

 

 

转载于:https://www.cnblogs.com/samual/archive/2010/02/07/pageblock.html

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值