简体   繁体   English

DPR 不适用于 firefox/chrome 检查器

[英]DPR not working on firefox/chrome inspector

My last question was closed for some reasons ( Chrome Inspector not even 1% accurate to real mobile devices )由于某些原因,我的最后一个问题已关闭( Chrome Inspector 对真实移动设备的准确率甚至不到 1%

However as it seems the problem was related to the DPR.然而,问题似乎与 DPR 有关。 I will attach images to show my problem我将附上图片以显示我的问题

Chrome/Firefox Inspector with DPR 2.0 for Iphone 6/7/8:适用于 Iphone 6/7/8 的带有 DPR 2.0 的 Chrome/Firefox Inspector:alt 标签



Real Iphone 6:真机 6:alt 标签

I can not simulate the DPR on any website on any browser on my pc or my friends pc.我无法在我的电脑或我朋友的电脑上的任何浏览器上的任何网站上模拟 DPR。 It will always scale like 1. Doesnt matter if I use DPR 1,2 or 3.它总是像 1 一样缩放。我使用 DPR 1,2 还是 3 都没有关系。

So my questions is how to successfully simulate DPR 2.0?所以我的问题是如何成功模拟 DPR 2.0?

I guess the problem is DPR or is it something else?我想问题是 DPR 还是别的什么?

First of all the bigger text was my bad, my iphone got bigger text set that was the reason why the text was different.首先,较大的文本是我的坏处,我的 iphone 有较大的文本集,这就是文本不同的原因。 However the core of this topic is still the same and the resolution is different to chrome inspector and real devices.但是这个话题的核心还是一样的,分辨率和chrome Inspector和真机不一样。 However mostly because of the browser taskbars.然而主要是因为浏览器任务栏。

As it seems no browser related inspector solution is working.似乎没有与浏览器相关的检查器解决方案有效。 However even when some people said it is not possible to emulate real devices it´s actually possible and also by google itself with android studio:然而,即使有人说不可能模拟真实设备,这实际上是可能的,而且谷歌本身也可以使用 android studio:

You can use any android version and create any resolution you want.您可以使用任何 android 版本并创建您想要的任何分辨率。 You can also test localhost from your host os inside of your emulated smartphone browser by using this instead of the default localhost/127.0.0.1:您还可以使用它而不是默认的 localhost/127.0.0.1 在模拟的智能手机浏览器中从您的主机操作系统测试 localhost:

  • 10.0.2.2 10.0.2.2

You can also open inspector of your emulated device from your main os!您还可以从主操作系统打开模拟设备的检查器! By using:通过使用:

  • chrome://inspect/#devices铬://检查/#devices

And here is starting the real question.这是真正的问题。 Why does this inspector window clone the correct device resolution from the emulated device?为什么此检查器窗口会从模拟设备克隆正确的设备分辨率? I mean it´s literally the default chrome inspector window again.我的意思是它实际上又是默认的 chrome 检查器窗口。 Very confusing.非常混淆。

They even clone the menubar, even when it´s now showing, the resolution and everything else was cloned 1to1 compared to the android studio emulator.他们甚至克隆了菜单栏,即使它现在正在显示,与 android studio 模拟器相比,分辨率和其他所有内容都是 1 对 1 克隆的。

However I guess it´s more realtime streaming than actually cloning.但是我想它比实际克隆更实时流式传输。

alt 标签

That´s to the point it´s not possible..那是不可能的..


Also maybe very nice to know that you can use the fullscreen API to dodge problems with those annoying browser taskbars which crash your ui and take space.也可能很高兴知道您可以使用全屏 API 来避免那些烦人的浏览器任务栏的问题,这些任务栏会使您的 ui 崩溃并占用空间。 You can use this code to enter fullscreen with user gesture:您可以使用此代码通过用户手势进入全屏:

<button id="goFS">Go fullscreen</button>
<script>
 $("#goFS").on("click",function(){
      
   // this works with scroll -  do not use document.body.requestFullscreen();   
   const elem = document.documentElement;
   if (elem.requestFullscreen) {elem.requestFullscreen()}

      if(document.fullscreenElement){
      console.log('fullscreen detected');
      }

  
 });
</script>

In fact it´s really sad that you have to download android developer software just to emulate real display solutions as web designer.事实上,你不得不下载安卓开发者软件只是为了作为网页设计师模拟真实的显示解决方案,这真的很令人难过。 I hope google will build in this technology in future inside of their chrome inspector.我希望谷歌将来会在他们的 chrome 检查器中内置这项技术。

Also I guess apple is providing the same software for their ios app development.另外我猜苹果正在为他们的 ios 应用程序开发提供相同的软件。 So you should be able to emulate iphones their too.所以你也应该能够模仿他们的 iphone。 However as far as I read you must use a MAC machine for this.但是,据我所知,您必须为此使用 MAC 机器。

Hope this will help anybody.希望这会帮助任何人。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM