Hidden window using javascript

前端 未结 3 638
广开言路
广开言路 2020-12-29 10:16

Just wanted to know if it is possible to create a hidden window using javascript?

相关标签:
3条回答
  • 2020-12-29 10:45

    Under IE 9+ you can create a window off-screen:

    var options = "left=" + (screen.width*2) + ",top=0";
    var myWin = window.open(url, name, options);
    // Hide the window - IE only
    myWin.blur();
    // Show the window - IE only
    myWin.focus();
    

    screen.width is your monitor width. Using "*2" allows for users with dual monitors.

    This does not work under Chrome.

    0 讨论(0)
  • 2020-12-29 10:49

    You can create an iframe

    var element = document.createElement("iframe"); 
    element.setAttribute('id', 'myframe');
    document.body.appendChild(element);
    

    You can hide an iframe by setting its width and height to zero or by setting its visibility to hidden in the stylesheet.

    0 讨论(0)
  • 2020-12-29 10:50

    You can also create a new window visible only in taskbar with this workaround:

    window.open(path.html,'_blank', 'toolbar=no,status=no,menubar=no,scrollbars=no,resizable=no,left=10000, top=10000, width=10, height=10, visible=none', ''); 
    

    that open a window in a position not visible by user. I have used this trick different times.

    0 讨论(0)
自定义标题
段落格式
字体
字号
代码语言
提交回复
热议问题