首页 \ 问答 \ 在桌面浏览器和ipad浏览器上显示不同的网站(Website displaying differently on desktop browser vs ipad browser)

在桌面浏览器和ipad浏览器上显示不同的网站(Website displaying differently on desktop browser vs ipad browser)

我目前正在努力从一开始就改造一个网站,以便与ipad友好。 我注意到它的大小与网站的桌面版本略有不同。 我已经包含了该网站的照片进行比较。

我正在使用<meta name="viewport" content="width=device-width, initial-scale=1">但仍然没有。

所有尺寸都以像素宽度或百分比设置。 蓝色侧边栏设置为px,右侧的内容区域是绝对定位的。

桌面屏幕截图: https//drive.google.com/file/d/0B0p4T6XDlqiyVmVnNmNFMDVBV00/edit?usp=sharing

iPad屏幕截图: https//drive.google.com/file/d/0B0p4T6XDlqiyQmVma291dkctV0E/edit?usp=sharing

多谢你们!


I am currently working on retrofitting a website from the ground up to be ipad friendly. I'm noticing that its size is slightly off compared to the desktop version of the site. I have included photos of the site for comparison.

I'm using <meta name="viewport" content="width=device-width, initial-scale=1"> and still nothing.

All sizes are set in pixel width or percentages. The blue sidebar is set in px, the content area to the right is just absolute positioned.

Desktop Screen Cap: https://drive.google.com/file/d/0B0p4T6XDlqiyVmVnNmNFMDVBV00/edit?usp=sharing

iPad Screen Cap: https://drive.google.com/file/d/0B0p4T6XDlqiyQmVma291dkctV0E/edit?usp=sharing

Thanks guys!


原文:https://stackoverflow.com/questions/20849069
更新时间:2022-06-10 10:06

最满意答案

我找不到任何说明或说明选项页面也是页面一部分的文档

注意:如果多个页面正在侦听onMessage事件,则只有第一个为特定事件调用sendResponse()才能成功发送响应。 对该事件的所有其他响应将被忽略。

但正如文件中提到的那样

https://developer.chrome.com/extensions/messaging#connect

长期连接

有时,持续时间长于单个请求和响应的对话很有用。 在这种情况下,您可以分别使用runtime.connect或tabs.connect,从内容脚本打开一个长期频道到扩展页面,反之亦然。 该通道可以选择具有名称,以便区分不同类型的连接。

你应该使用connect你的用例


I couldn't find any documentation which explains or documents that Option page is also part of the pages

Note: If multiple pages are listening for onMessage events, only the first to call sendResponse() for a particular event will succeed in sending the response. All other responses to that event will be ignored.

But as mentioned in the documentation

https://developer.chrome.com/extensions/messaging#connect

Long-lived connections

Sometimes it's useful to have a conversation that lasts longer than a single request and response. In this case, you can open a long-lived channel from your content script to an extension page , or vice versa, using runtime.connect or tabs.connect, respectively . The channel can optionally have a name, allowing you to distinguish between different types of connections.

You should be using connect for your use-case

相关问答

更多
  • 当调用chrome.tabs.create或chrome.tabs.update的回调时,无法保证页面已完全加载。 如果在调用chrome.tabs.sendMessage时页面未完成加载,则页面将不会收到该消息(如果检查chrome.runtime.lastError.message则可能会看到“无法建立连接。接收端不存在。” chrome.runtime.lastError.message )。 解决问题的正确方法是使用chrome.tabs.onUpdated来检测选项卡何时完成加载: chrome. ...
  • 在你的背景页面你应该打电话 chrome.tabs.query({active: true, currentWindow: true}, function(tabs){ chrome.tabs.sendMessage(tabs[0].id, {action: "open_dialog_box"}, function(response) {}); }); 而不是像你当前一样使用chrome.extension.sendMessage 。 chrome.tabs变体向内容脚本发送消息,而chrom ...
  • 根据我的理解,您希望向background.js发送消息,并且不希望收到回复。 如果我是正确的,那么你只需要发送一条消息并忘记“sendResponse” 。 我来给你展示。 内容,JS window.onload = function(){ chrome.extension.sendMessage('Hi, i opened'); } 并在background.js chrome.runtime.onMessage.addListener(function(request, sender, sen ...
  • 我找不到任何说明或说明选项页面也是页面一部分的文档 注意:如果多个页面正在侦听onMessage事件,则只有第一个为特定事件调用sendResponse()才能成功发送响应。 对该事件的所有其他响应将被忽略。 但正如文件中提到的那样 https://developer.chrome.com/extensions/messaging#connect 长期连接 有时,持续时间长于单个请求和响应的对话很有用。 在这种情况下,您可以分别使用runtime.connect或tabs.connect,从内容脚本打开一个 ...
  • 您一直在尝试使用