屏幕分辨率
从脚本访问某些站点时如何替换屏幕分辨率?当自己的脚本连接到服务器时是否可以访问这些数据?
how can I replace screen resolution when accessing some site from script? Is it possible to acces such data when own script connects to the server?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
给出一个非常明确的答案:
$_POST
超全局中)作为最佳实践,您的网站应该通过 固定、流动或弹性布局。更改用户的分辨率对于用户来说是一种令人沮丧的体验,并且会使项目运行得很糟糕。
另请记住,许多平台的分辨率无法更改。大多数移动设备、嵌入式平台和视频游戏机都有固定的分辨率。此外,投影仪和电视通常具有非常特定的分辨率才能正常运行,因此调整这些设备上的分辨率可能会造成严重破坏。
作为调整屏幕分辨率的替代方法,请查看 em 驱动布局< /a>. em 是 CSS 中相对于当前字体的度量单位。这允许您通过调整文档的字体大小来动态调整布局及其内容的大小(较大的字体大小将增加页面上其他所有内容的逐像素大小)。
需要注意的是,在 Windows 上可以通过 ActiveX 来调整分辨率,但必须在出现多次安全警告后才能进行(并且仅在 Windows 上的 IE 中有效)。在任何情况下都不应尝试这样做。
To give a very definitive answer:
$_POST
superglobal)As a best practice, your website should be resolution independent by means of a fixed, fluid, or elastic layout. Changing a user's resolution is a frustrating experience for users and makes a project operate badly.
Keep in mind, also, that many platforms cannot have their resolutions altered. Most mobile devices, embedded platforms, and video game consoles have fixed resolutions. Also, projectors and televisions usually have very specific resolutions at which they function properly, so adjusting the resolution on these devices would likely wreak havoc.
As an alternative to adjusting screen resolution, check out em-driven layout. An em is a unit of measure in CSS that is relative to the current font. This allows you to dynamically adjust the sizing of your layout and its contents by adjusting the font size of the document (a larger font size will increase the pixel-for-pixel sizes of everything else on the page).
It should be noted that adjusting resolution can be accomplished via ActiveX on Windows, but only after multiple security warnings (and it only works on Windows in IE). This should not be attempted under any circumstances.
如果我正确理解你的问题,这就是我的回答。当用户访问您的网站时,无法更改用户的屏幕分辨率。
Here is my answer if I understood your question correctly. It is not possible to change screen resolution for a user when he/she accesses your site.
您是说该网站正在根据其认为的用户屏幕分辨率来改变其行为吗?这是 a) 不良行为,b) 客户端,因此使用 JavaScript 或 ActiveX 控件等完成。
如果您希望您的脚本模仿这一点,它必须解释 JavaScript、运行 ActiveX 或其他什么。
网站没有自己的“屏幕分辨率”。它们会呈现为浏览器的任何大小。这就是 HTML 之美的一部分。
Are you saying that the site is changing its behavior based on what it thinks the user's screen resolution is? That's a) bad behavior, and b) client-side, so done with JavaScript or an ActiveX control or the like.
If you want your script to mimic that, it'll have to interpret the JavaScript, run the ActiveX, or whatever.
Sites don't have their own "screen resolution". They're rendered to whatever size the browser is at. That's part of the beauty of HTML.