是否可以向iframe src请求添加请求标头?

编程入门 行业动态 更新时间:2024-10-25 00:26:21
本文介绍了是否可以向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请求添加请求标头?

本文发布于:2023-10-29 10:23:20,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1539440.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:iframe   src

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!