检测放大Firefox [英] Detect Zoom in Firefox

查看:105
本文介绍了检测放大Firefox的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想检测浏览器是否放大或缩小(不要真正关心的值,但我认为它将需要在决策过程中找到)。我已经阅读了很多关于这个话题的其他SO的帖子,但没有一个解决方案给定工作在FF(虽然有一个IE7 / 8和chrome解决方案)。



哦,我不能使用闪存,所以闪存解决方案是没有问题的。



编辑:我必须能够在初始页面加载时检测到这一点。

解决方案

现代版本的FireFox现在可以执行以下操作:

  DPR = window.devicePixelRatio; 
if(DPR< = 0.999 || DPR> = 1.001){
//用户放大或缩小
}
/ pre>

I want to detect if the browser is zoomed in or out (don't really care to know the value, but I assume it will need to be found anyway in the decision process). I have read a lot of other SO posts on the topic, but none of the solutions given work on FF (although there is an IE7/8 and chrome solution).

Oh, and I can't use flash, so the flash solution is out of the question.

Edit: And I must be able to detect this on the initial page load

解决方案

With modern versions of FireFox, you can now do the following:

DPR = window.devicePixelRatio;
if ( DPR <= 0.999 || DPR >= 1.001 ){
   // User has zoomed in or zoomed out
}

这篇关于检测放大Firefox的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆