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

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

问题描述

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

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

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

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天全站免登陆