zoukankan      html  css  js  c++  java
  • window.open被IE拦截的解决办法

    由于在使用window.open时,在很多情况下,弹出的窗口会被浏览器阻止,但若是使用a链接target='_blank',则不会,基于这一特点,自己封装了一个open方法:

    function openwin(url) {
        var a = document.createElement("a");
        a.setAttribute("href", url);
        a.setAttribute("target", "_blank");
        a.setAttribute("id", "openwin");
        document.body.appendChild(a);
        a.click();
    }


    使用方法:

    1. 在html页面里面添加<body></body>标签,如果已有,则不加。

    2. 在js块中,直接调用上面的openwin('url')即可。

      转自:http://blog.csdn.net/fanfanjin/article/details/6858168

  • 相关阅读:
    mybatis
    spring mvc
    Spring Boot2
    Spring AOP
    Spring Boot1
    Spring IOC
    Multiple_LinearRegression_Test2
    Multiple_LinearRegression_Test
    Simple_LinearRegression_Test
    写决策树时遇到的坑
  • 原文地址:https://www.cnblogs.com/ae6623/p/4416251.html
Copyright © 2011-2022 走看看