我有一个 Angular 应用程序,它托管在我的 Tomcat 上(我无法修改它的源代码,但我可以随意配置 Tomcat)。这个应用程序允许在 iframe 中显示我的代码(这是同一个文件夹中的简单 JSP!)。
要从“我的”iframe(即 window.parent
)访问此应用程序,我需要做什么?
现在,当我从 iframe 尝试 window.parent 时(在 Firefox 中):
Permission denied to access property Symbol.toPrimitive on cross-origin object
在浏览器控制台中。 因为它都托管在同一个 Tomcat 上,所以它是同源的,所以我该怎么做才能告诉浏览器允许从 iframe 访问父窗口?
已经在 web.xml 中试过了:
<filter>
<filter-name>httpHeaderSecurity</filter-name>
<filter-class>org.apache.catalina.filters.HttpHeaderSecurityFilter</filter-class>
<init-param>
<param-name>antiClickJackingOption</param-name>
<param-value>SAMEORIGIN</param-value>
</init-param>
</filter>
<filter-mapping>
<filter-name>httpHeaderSecurity</filter-name>
<url-pattern>/*</url-pattern>
<dispatcher>REQUEST</dispatcher>
</filter-mapping>
我做错了什么?
提前致谢!