我有一个Web应用程序,我想实现以下行为。
I have a web application that I'd like to implement the following behavior.
当您点击特定链接时:
-
如果用户有多个监视器 - 在具有给定名称的窗口中打开URL。
If the user has more than one monitor - open the url in a window with a given name.
否则 - 将iframe的src属性更改为url属性。
Otherwise - change the iframe's src attribute to that of the url.
如何做我在JavaScript中检测到了显示器数量?
如果不可能,那么仅限Chrome的解决方案也适用于Intranet应用程序。
If it's impossible, a Chrome only solution would also work since this is for an intranet app.
推荐答案正如其他人所说,唯一明智的做法是询问用户。之前提出并拒绝了允许这种做法的提案。多显示器设置在一般人群中并不常见,这就是为什么会被忽略的原因。
As others have said the only sensible way to do this is to ask the user. A proposal to allow this has been raised and declined before. Multi monitor setups are not very common in the general population which is why this is ignored.
替代方案是:
- 提示用户。
- 要求用户运行浏览器扩展程序(不那么有趣,风险更大)。
- 通过插件运行(也不是很有趣)。
- 通过类似WebkitJS的方式提供您的应用程序
- Prompt the user.
- Ask the user to run a browser extension (less fun and more risky).
- Run through a plugin (also not very fun).
- Serve your app through something like WebkitJS
总体而言 - 对于普通网站,唯一的选择是提示用户。
Overall - for normal websites the only option is to prompt the user.
更多推荐
获取监视器计数
发布评论