iframe 中的链接正常,但不显示在嵌入页面中

问题描述

我正在尝试使用 iframe 将地图嵌入到旅游博客中。底层网页很好,但它没有显示在 iframe 中。我怀疑是尺寸问题,我试过调整各种参数。有谁知道我接下来可以尝试什么?

我可以在 jsfiddle 下重现这个问题。

<iframe src="https://trackmytour.com/cgkvp/e" width="100%" height="300" style="border: 1px solid black;">
</iframe>

解决方法

尝试加载 iframe 时来自控制台的引用:

跨源请求被阻止:Same-Origin-Rule 禁止读取 https://trackmytour.com/static/vue/js/chunk-vendors.2eefddd2.js 处的外部资源。 (原因:缺少 CORS-Header 'Access-Control-Allow-Origin')。

这就是您无法在 iframe 中看到它的原因。 可以在 here 中找到更多详细信息。如果您不是网站的所有者并且可以访问网络服务器,则无法避免此问题:您尝试执行的操作不可能,抱歉...