以编程方式传递其他标头信息以及URL以打开浏览器 [英] Programmatically pass additional header info along with URL to open a browser

查看:60
本文介绍了以编程方式传递其他标头信息以及URL以打开浏览器的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个应用程序,它有一次要在默认浏览器中启动特定的URL。这非常简单,可以在Windows上使用ShellExecute来实现。但是,要注意的是服务器希望将一些其他自定义标头信息(用于身份验证/标识)与GET请求一起发送。
启动时是否可以通过任何方式将此(附加标头)信息传递给浏览器?

I have an application which at one point wants to launch a particular URL in the default browser. This is pretty simple and can be achieved using ShellExecute on Windows. However the catch is that the server expects some additional custom header information (for authentication/identification purposes) to be sent along with the GET request. Is there any way by which this (additional header) information could be passed to the browser while launching it?

注意:-我要启动默认值浏览器而不使用Web浏览器控件

Note:- I want to launch the default browser and not use a Web browser control

推荐答案

据我所知,您只有一个选择:添加中间页(在Internet上还是在

As I understand you have only one option: add intermidiate page (in internet or on localhost).

您必须创建 yoursite.com/sendHeaders.php localhost /sendHeaders.php (或任何其他扩展;选择您喜欢的语言),它执行以下操作:

You have to create yoursite.com/sendHeaders.php or localhost/sendHeaders.php (or any another extension; choose language what do you prefer), which does following:


  • 解压缩参数(URL和标题),

  • 连接到URL,发送标题,

  • 在浏览器中打印答案。

因此,您将在浏览器中间页 yoursite.com/sendHeaders.php?url=realUrl&headers=packedHeaders ,但浏览器将向您显示页面 realUrl ,该页面已收到适当的标题。

So you will open in your browser intermediate page yoursite.com/sendHeaders.php?url=realUrl&headers=packedHeaders, but browser will show you a page realUrl, which received proper headers.

这篇关于以编程方式传递其他标头信息以及URL以打开浏览器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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