<脚本>或<无脚本>?

发布于 2024-09-19 18:30:51 字数 353 浏览 1 评论 0原文

我只是想知道什么是更好的解决方案。

我的网站上有一个带有谷歌地图的 iFrame。 iframe 有一个 id="map"。 我现在想知道如果我不希望地图在 javascript 关闭时显示,更好的解决方案是什么。

我应该有一个

<noscript> <style type="text/css"> #map {display:none) </style> </noscript>

或者我可以将整个 iFrame 包裹在 iFrame 中,以确保它在 js 打开时显示出来。

谢谢你的建议!

i just wonder what's the better solution.

I have an iFrame with a google map on my website. the iframe has an id="map".
I wonder now what's the better solution if I don't want the map to show if javascript is turned off.

should I have a

<noscript> <style type="text/css"> #map {display:none) </style> </noscript>

or can I wrap the whole iFrame inside of a iFrame to make sure it does just show up if js is turned on.

thank you for your advice!

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

佞臣 2024-09-26 18:30:51

您可以将 display: none 设置为 #map 容器的默认。在负责构建地图的 Javascript 中,您要做的第一件事是将其切换为 display: block

但这真的有必要吗?通常你的 #map 容器应该只是一个空的占位符,如果 Javascript 不可用,它就不会被填充。

You can make display: none the default for the #map container. In the Javascript that is responsible for constructing the map, the first thing you do is to switch it to display: block.

But is this really necessary? Usually your #map container should only be an empty placeholder anyway, which simply won't get populated if Javascript is not available.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文