是否可以向iframe src请求添加请求标头? [英] Is it possible to add Request Headers to an iframe src request?

查看:6708
本文介绍了是否可以向iframe src请求添加请求标头?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我知道在JavaScript中进行AJAX调用时,可以非常轻松地设置HTTP请求标头。

I understand that you can set HTTP request headers very easily when making AJAX calls in JavaScript.

但是,插入时也可以设置自定义HTTP请求标头iframe通过脚本进入页面?

However is it also possible to set custom HTTP request headers when inserting an iframe into a page via script?

<iframe src="someURL"> <!-- is there any place to set headers in this? -->


推荐答案

不,你不能。但是,您可以将 iframe 源设置为某种预加载脚本,该脚本使用AJAX来获取包含所需标题的实际页面。

No, you can't. However you could set the iframe source to some kind of preload script, which uses AJAX to fetch the actual page with all the headers you want.

这篇关于是否可以向iframe src请求添加请求标头?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆