admin管理员组文章数量:1356554
I'm working on a website, and I've run into trouble modifying an HTTP Response header using (client-side) JavaScript. I have exactly zero idea how to do this. I know (roughly) how to make the 'for' loop to modify the header, but I don't know how to access the header within the script. Could y'all fine people help me with this fun task?
I'm working on a website, and I've run into trouble modifying an HTTP Response header using (client-side) JavaScript. I have exactly zero idea how to do this. I know (roughly) how to make the 'for' loop to modify the header, but I don't know how to access the header within the script. Could y'all fine people help me with this fun task?
Share Improve this question edited Jan 15, 2014 at 22:16 Zach Lysobey 15.8k21 gold badges100 silver badges152 bronze badges asked Jan 15, 2014 at 22:05 bluebunnybluebunny 3153 silver badges14 bronze badges 11- 3 mind if I ask what you're trying to acplish by doing this? – Zach Lysobey Commented Jan 15, 2014 at 22:07
- 1 But I think this has your answer: stackoverflow./questions/220231/… – Zach Lysobey Commented Jan 15, 2014 at 22:08
- 2 @Barmar: Depends on where the JavaScript is running. If it's running on the server... – T.J. Crowder Commented Jan 15, 2014 at 22:08
- 1 @T.J.Crowder Unless they specifically say they're using something like Node.js, I'm going to regularly assume that JS == client, not server. – Barmar Commented Jan 15, 2014 at 22:09
- 1 Alright, for clarification: I need to modify the response header to remove X-Frame-Options to load one site in an iFrame. Is it possible to have the script run after receipt of the header, then pass the header along to the iFrame afterwards? – bluebunny Commented Jan 15, 2014 at 22:10
1 Answer
Reset to default 8With client-side JavaScript (JavaScript running in a browser), you can't do this; by the time the JavaScript code runs, the headers have already been processed.
本文标签: htmlModify HTTP response header with (Clientside) JavascriptStack Overflow
版权声明:本文标题:html - Modify HTTP response header with (Client-side) Javascript - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1743998667a2573455.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论