网站优化

网站优化

Products

当前位置:首页 > 网站优化 >

无法在wordpress页面中加载iframe

GG网络技术分享 2025-03-18 16:12 4


问题描述:

I have been trying to load an section of page using iframe in my wordpress site. I can load certain sites in the iframe without any issue but while i try my required page it doesn\'t work as expected just inside the page. The iframe src is loading perfectly if its opened individually

I have tried most of the answers mentioned here in stackoverflow and other forums, still can\'t get a solution for this. I tried adding code in .htaccess, also tried adding code in functions.php

This is the iframe src I want to load.

It can be loaded individually in browser but not inside an iframe. I am getting the following error in console while i try to load it :

[ERROR] Permission denied to access property \"hash\" on cross-origin object

Is this an issue with my code, server config or with the URL itself?

Thanks

图片转代码服务由CSDN问答提供

感谢您的意见,我们尽快改进~

功能建议

我一直在尝试使用中的 iframe </ code>加载一部分页面 wordpress </ code>网站。 我可以在 iframe </ code>中加载某些网站而不会出现任何问题,但是当我尝试我所需的页面时,它在页面内部无法正常工作。 iframe </ code> src如果单独打开则完全加载</ p>

我已经尝试了 stackoverflow </ code>和其他论坛中提到的大部分答案, 仍然无法得到解决方案。 我尝试在 .htaccess </ code>中添加代码,也尝试在 functions.php中添加代码</ code> </ p>

这是我要加载的 iframe </ code> src 。 </ p>

它可以在浏览器中单独加载,但不能在 iframe </ code>中加载。 我在尝试加载它时在控制台中收到以下错误:</ p>

[错误]在跨源对象上访问属性“hash”的权限被拒绝</ p>

这是我的代码,服务器配置还是URL本身的问题?</ p>

谢谢</ p>

</ div>

网友观点:

It\'s about your source is blocking unauthorization call from domains not in CORS. They\'re only allow call from Origin https://ec.europa.eu. The short answer, you can\'t deal anything from your side.

More information about CORS: https://developer.mozilla.org/en/docs/Web/HTTP/Access_control_CORS

标签:

提交需求或反馈

Demand feedback