我必须在 iframe 中显示 MEAN.JS 应用程序,所以我从一个简单的 html 文件开始:
<iframe style="height: 100%; width: 100%;" src="http://localhost:3000/#!/workouts"></iframe>
但是然后 iframe 内容是空的,请有人帮助我吗?
明白了:我的应用正在使用 Helmet ( https://github.com/evilpacket/helmet ),它在 X-Frame-Options 中设置了 DENY。因此,在我的 Express 配置中,我设置了:
app.use(helmet.xframe('ALLOW-FROM', 'www.mydomain.com'));
它奏效了