在不同显示器上自动打开页面

发布于 2024-10-31 02:27:37 字数 144 浏览 7 评论 0原文

我正在设计一个紧急响应页面,需要在 3 个不同的显示器上显示信息。第一个监视器将收集有关调用者的信息,然后包含 2 个链接。第一个链接需要在第二个显示器上显示不同的网页,第二个链接需要在第三个显示器上显示不同的网页。

这可能吗?

感谢您的帮助

I am designing an emergency response page, which needs to display information across 3 different monitors. The first monitor will gather information about the caller, and then contain 2 links. The first link needs to display a different web page on the 2nd monitor, and the 2nd link needs to display a different web page on the 3rd monitor.

Is this possible?

Thanks for any help

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(4

彡翼 2024-11-07 02:27:37

第一个链接需要在第二个显示器上显示不同的网页,第二个链接需要在第三个显示器上显示不同的网页。

虽然根据您的操作系统,可以控制窗口的显示位置,但通过 HTTP/浏览器使用 javascript/服务器端代码来执行此操作的选项要少得多。

实现这一目标的唯一明智方法是将显示器配置为更大显示器的平铺而不是独立屏幕(对于 *nix/BSD/Linux,请查看 xinerama)。

下面的代码保存了窗口的大小 - 并且只需要一些简单的更改来支持 x/y 偏移和多个窗口 - 我将如何区分窗口的问题留给您。

一种更简单的方法是只有一个巨大窗口,其框架的边框与显示器对齐。

if (document.getElementById && !document.all) { // NOT for MSIE
    stickySizeOverloadOnload(stickySizeSetWindowSize);
    stickySizeOverloadOnresize(stickySizeSaveWindowSize);
}

function stickySizeSaveWindowSize(event)
{
    var expiry = new Date();
    var path = document.location.pathname;

    expiry.setDate(expiry.getDate()+500);
    stickySizeSetCookie('windowSize', window.outerWidth + ',' + window.outerHeight, expiry, path);
}

function stickySizeSetWindowSize()
{
    var saved=stickySizeGetCookie('windowSize');
    var parts=new Array();
    if (saved.length) {
    parts = saved.split(',');
    if ((parts[0]>100) && (parts[1]>100)) {
        window.outerWidth=parts[0];
        window.outerHeight=parts[1];
    } else {
        alert("invalid size - '" + saved + "'");
        stickySizeDeleteCookie('windowSize');
    }
}
}

function stickySizeOverloadOnload(func)
{
   var oldhandler=window.onload;
   if (typeof window.onload != "function") {
      window.onload=func;
   } else {
     window.onload=function(event) {
       oldhandler(event);
   func(event);
     }
   }
}
function stickySizeOverloadOnresize(func)
{
   var oldhandler=window.onresize;
   if (typeof window.onresize != "function") {
      window.onresize=func;
   } else {
      window.onresize=function(event) {
         oldhandler(event);
         func(event);
      }
   }
}

function stickySizeSetCookie(name, value, expires, path, domain, secure) {
  var curCookie = name + "=" + escape(value) +
  ((expires) ? "; expires=" + expires.toGMTString() : "") +
  ((path) ? "; path=" + path : "") +
  ((domain) ? "; domain=" + domain : "") +
  ((secure) ? "; secure" : "");
  document.cookie = curCookie;
}
function stickySizeGetCookie(name) {
   var dc = document.cookie;
   var prefix = name + "=";
   var begin = dc.indexOf("; " + prefix);
   if (begin == -1) {
      begin = dc.indexOf(prefix);
      if (begin != 0) return null;
   } else
      begin += 2;
   var end = document.cookie.indexOf(";", begin);
   if (end == -1)
   end = dc.length;
   return unescape(dc.substring(begin + prefix.length, end));
}
function stickySizeDeleteCookie(name, path, domain) {
   if (stickySizeGetCookie(name)) {
      document.cookie = name + "=" +
        ((path) ? "; path=" + path : "") +
        ((domain) ? "; domain=" + domain : "") +
        "; expires=Thu, 01-Jan-70 00:00:01 GMT";
   }
}

The first link needs to display a different web page on the 2nd monitor, and the 2nd link needs to display a different web page on the 3rd monitor.

While, depending on your operating system, it is possible to control where a window appears, there are much fewer options for doing this using javascript / serverside code over HTTP / browsers.

The only sensible way to achieve this is by configuring the displays to be tiles of a larger display rather than independent screens (for *nix/BSD/Linux, check out xinerama).

The code below saves the size of a window - and would only need some simple changes to support x/y offset and multiple windows - I leave it to you as to how you differentiate between the windows.

A simpler approach would be to just have one huge window with frames whose borders align with the monitors.

if (document.getElementById && !document.all) { // NOT for MSIE
    stickySizeOverloadOnload(stickySizeSetWindowSize);
    stickySizeOverloadOnresize(stickySizeSaveWindowSize);
}

function stickySizeSaveWindowSize(event)
{
    var expiry = new Date();
    var path = document.location.pathname;

    expiry.setDate(expiry.getDate()+500);
    stickySizeSetCookie('windowSize', window.outerWidth + ',' + window.outerHeight, expiry, path);
}

function stickySizeSetWindowSize()
{
    var saved=stickySizeGetCookie('windowSize');
    var parts=new Array();
    if (saved.length) {
    parts = saved.split(',');
    if ((parts[0]>100) && (parts[1]>100)) {
        window.outerWidth=parts[0];
        window.outerHeight=parts[1];
    } else {
        alert("invalid size - '" + saved + "'");
        stickySizeDeleteCookie('windowSize');
    }
}
}

function stickySizeOverloadOnload(func)
{
   var oldhandler=window.onload;
   if (typeof window.onload != "function") {
      window.onload=func;
   } else {
     window.onload=function(event) {
       oldhandler(event);
   func(event);
     }
   }
}
function stickySizeOverloadOnresize(func)
{
   var oldhandler=window.onresize;
   if (typeof window.onresize != "function") {
      window.onresize=func;
   } else {
      window.onresize=function(event) {
         oldhandler(event);
         func(event);
      }
   }
}

function stickySizeSetCookie(name, value, expires, path, domain, secure) {
  var curCookie = name + "=" + escape(value) +
  ((expires) ? "; expires=" + expires.toGMTString() : "") +
  ((path) ? "; path=" + path : "") +
  ((domain) ? "; domain=" + domain : "") +
  ((secure) ? "; secure" : "");
  document.cookie = curCookie;
}
function stickySizeGetCookie(name) {
   var dc = document.cookie;
   var prefix = name + "=";
   var begin = dc.indexOf("; " + prefix);
   if (begin == -1) {
      begin = dc.indexOf(prefix);
      if (begin != 0) return null;
   } else
      begin += 2;
   var end = document.cookie.indexOf(";", begin);
   if (end == -1)
   end = dc.length;
   return unescape(dc.substring(begin + prefix.length, end));
}
function stickySizeDeleteCookie(name, path, domain) {
   if (stickySizeGetCookie(name)) {
      document.cookie = name + "=" +
        ((path) ? "; path=" + path : "") +
        ((domain) ? "; domain=" + domain : "") +
        "; expires=Thu, 01-Jan-70 00:00:01 GMT";
   }
}
桃扇骨 2024-11-07 02:27:37

您可以使用属性 target="windowName" 在不同窗口中打开链接。

您必须手动设置三个窗口,因此手动将它们分配给三个屏幕。当您在窗口中再次打开链接时,它仍然在同一屏幕上。

You can open the links in a different window with the attribute target="windowName".

You have to set up the three windows manually, so assign them manually to the three screens. When you open a link again in a window it is still on the same screen.

千柳 2024-11-07 02:27:37

看看 Java:获取一个/所有可用显示器(而不是整个桌面)的分辨率?

(答案讨论 GraphicsEnvironment.getLocalGraphicsEnvironment() 调用)

Have a look at Java: Getting resolutions of one/all available monitors (instead of the whole desktop)?

(The answer discuss the GraphicsEnvironment.getLocalGraphicsEnvironment() call)

霓裳挽歌倾城醉 2024-11-07 02:27:37

如果您确实希望将窗口锁定到特定监视器,则需要实现此客户端。这是一个链接描述如何检测哪些在 Java 中监视窗口,因此您可以根据需要将其移动到正确的监视器并最大化窗口。显然,您可以实现系统服务器端的其余部分,并仅在您创建的窗口内显示页面。

If you really want the windows to be locked to a specific monitor, you will need to implement this client side. Here is a link describing how to detect which monitor a window is on in Java, so you can move it to the proper monitor and maximize the window if you desire. Obviously you can implement the rest of the system server side and just display pages inside the windows you have created.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文