zoukankan      html  css  js  c++  java
  • js推送网页到扩展屏上

    需求:

      电脑上有两个屏幕,想在主屏上的网页中点击一个按钮,副屏就可以显示需要推送过去的网页

    实现方法:

      本方法使用的是js来实现的,亲测可行,支持火狐,但是不支持谷歌

    demo:

    主屏网页:1.html

    <!DOCTYPE html>
    <html lang="en">
    <head>
        <meta charset="UTF-8">
        <meta name="viewport" content="width=device-width, initial-scale=1.0">
        <title>js推送网页到扩展屏上</title>
    </head>
    <body>
        <button onclick="test()">推送网页到扩展屏</button>
        <p id="a"></p>
        <script>
            var aa;
            function test(){
                // 获取主屏宽度
                const width = screen.availWidth;
    
                // 宽为100,高为400,距屏顶0象素,屏左0象素,无工具条,无菜单条,无滚动条,不可调整大小,无地址栏,无状态栏
                window.open('2.html','newwindow','height=100,width=400,top=0,left='+ width +',toolbar=no,menubar=no,scrollbars=no,resizable=no,location=no,status=no')
            }
        </script>
    </body>
    </html>
    

      

    副屏网页: 2.html

    <!DOCTYPE html>
    <html lang="en">
    <head>
        <meta charset="UTF-8">
        <meta name="viewport" content="width=device-width, initial-scale=1.0">
        <title>Document</title>
    </head>
    <body>
        <h1>我是被推送的网页</h1>
    </body>
    </html>
    

      

  • 相关阅读:
    git升级
    redis集群
    redis安装
    escript
    git搭建仓库与服务器
    svnsync
    post_commit.sh
    nvm安装和使用
    quartz 定时器
    Oracle flashback恢复误删的数据或表
  • 原文地址:https://www.cnblogs.com/shiyixirui/p/14282579.html
Copyright © 2011-2022 走看看