繁体   English   中英

Iframe 渲染错误:<rect> 属性宽度:负值无效</rect>

[英]Iframe rendering error : <rect> attribute width: A negative value is not valid

我正在尝试将来自Google Ngram Viewer的 iframe 集成到我的 rails 应用程序的页面中。 该应用程序目前正在开发中,奇怪的是,有时 Ngram Iframe 不会出现并引发错误:

ngram-viewer-deps.js:50 错误:属性宽度:负值无效。 (“-152”)

Here is the corresponding iframe URL: https://books.google.com/ngrams/interactive_chart?content=aspirateur&year_start=1700&year_end=2008&corpus=19&smoothing=3&direct_url=t1%3B%2Caspirateur%3B%2Cc0

这是渲染的 iframe 元素(我在这里只复制/粘贴外部 HTML):

<iframe name="ngram_chart" src="https://books.google.com/ngrams/interactive_chart?content=aspirateur&amp;year_start=1700&amp;year_end=2008&amp;corpus=19&amp;smoothing=3&amp;direct_url=t1%3B%2Caspirateur%3B%2Cc0" width="800" height="335" marginwidth="0" marginheight="0" hspace="0" vspace="0" frameborder="0" scrolling="no"></iframe>

知道如何防止此错误发生吗? 谢谢。

老实说,我现在不关心谷歌 Ngram 查看器,但我相信这个错误意味着 iframe 容器宽度变得太小了。 该查看器中可能有一个代码检查 iframe 的实际宽度,当宽度由于其他元素的溢出而非常小或为负时,它会引发此错误。

我将首先检查 iframe 在不同屏幕上可用的宽度,尤其是较小的屏幕。

快速尝试可能是在 iframe 上设置最小宽度并检查错误是否仍然存在。

暂无
暂无

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

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