English 中文(简体)
窗户开户
原标题:window.open with headers

Can I control the HTTP headers sent by window.open (cross browser)?

如果没有的话,我可以选择<代码>window. open。 a page that when issues my request with Customs Headers within its poppedup即?

I need some cunning hacks.

最佳回答

我能否控制通过窗口(交叉浏览器)发送的吉大港游轮头?

否则,我就能够 window窗。 开放一页,然后在播种窗口内向海关负责人提出我的要求?

  • You can request a URL that triggers a server side program which makes the request with arbitrary headers and then returns the response
  • You can run JavaScript (probably saying goodbye to Progressive Enhancement) that uses XHR to make the request with arbitrary headers (assuming the URL fits within the Same Origin Policy) and then process the result in JS.

我需要一些避风港。

It might help if you described the problem instead of asking if possible solutions would work.

问题回答

可悲的是,在窗口时,你可以控制头盔。

尼斯和简便,我如何设法向海关负责人开放档案:

const viewFile = async (url) => {

  // Change this to use your HTTP client
      fetch(url, {/*YOUR CUSTOM HEADER*/} ) // FETCH BLOB FROM IT
        .then((response) => response.blob())
        .then((blob) => { // RETRIEVE THE BLOB AND CREATE LOCAL URL
          var _url = window.URL.createObjectURL(blob);
          window.open(_url, "_blank").focus(); // window.open + focus
      }).catch((err) => {
        console.log(err);
      });
};
  • Download file to cache
  • window.open to cache

If you are in control of server side, it might be possible to set header value in query string and send it like that? That way you could parse it from query string if it s not found in the headers.

只是一个想法...... 你们要求有一个ning车:

您也可使用F5载荷平衡器,并绘制你试图在原籍地内穿透URL的交叉浏览器图。

测绘可以像:

companyA.com/api/of/interest----> companyB.com/api/of/interest

假设你的原产地是“公司”,那么浏览器在发出这一请求时不会遇到任何问题,因为它向同一领域倾斜。

这项请求击中了负荷平衡器,并提交给了所有头盔回复的“公司B.com”,将送交服务器一侧。





相关问题
selected text in iframe

How to get a selected text inside a iframe. I my page i m having a iframe which is editable true. So how can i get the selected text in that iframe.

How to fire event handlers on the link using javascript

I would like to click a link in my page using javascript. I would like to Fire event handlers on the link without navigating. How can this be done? This has to work both in firefox and Internet ...

How to Add script codes before the </body> tag ASP.NET

Heres the problem, In Masterpage, the google analytics code were pasted before the end of body tag. In ASPX page, I need to generate a script (google addItem tracker) using codebehind ClientScript ...

Clipboard access using Javascript - sans Flash?

Is there a reliable way to access the client machine s clipboard using Javascript? I continue to run into permissions issues when attempting to do this. How does Google Docs do this? Do they use ...

javascript debugging question

I have a large javascript which I didn t write but I need to use it and I m slowely going trough it trying to figure out what does it do and how, I m using alert to print out what it does but now I ...

Parsing date like twitter

I ve made a little forum and I want parse the date on newest posts like twitter, you know "posted 40 minutes ago ","posted 1 hour ago"... What s the best way ? Thanx.