javascript - Send client certificate using XHR - Stack Overflow

I'm trying to open an ssl service with java script.In order to do so, I need to send my certifica

I'm trying to open an ssl service with java script. In order to do so, I need to send my certificate with xmlhttp object. Can I do it with java script? I could not find how to do it anywhere.

my code looks like this:

xmlhttp.open("post","https://[some ip]:[some secured port]",false);
xmlhttp.send();

However it's not working. On the other hand, when using: "https://[some ip]:[some secured port]" - directly from my browser - It is telling me to choose a certificate and it's working well.

How can I make it work straight from the java script? What should be the solution to my situation?

I'm trying to open an ssl service with java script. In order to do so, I need to send my certificate with xmlhttp object. Can I do it with java script? I could not find how to do it anywhere.

my code looks like this:

xmlhttp.open("post","https://[some ip]:[some secured port]",false);
xmlhttp.send();

However it's not working. On the other hand, when using: "https://[some ip]:[some secured port]" - directly from my browser - It is telling me to choose a certificate and it's working well.

How can I make it work straight from the java script? What should be the solution to my situation?

Share Improve this question edited Mar 11, 2012 at 11:52 matthewk 1,8411 gold badge17 silver badges31 bronze badges asked Mar 11, 2012 at 10:51 user967710user967710 2,0073 gold badges36 silver badges62 bronze badges 1
  • you might wanna read this extensive talk about a similar issue: stackoverflow./q/9542772/575527 – Joseph Commented Mar 11, 2012 at 11:06
Add a ment  | 

2 Answers 2

Reset to default 4

I don't think that's possible.

Besides that, the same origin policy would most likely cause problems for you.

There's one solution you might consider. If you detect that the certificate is absent, you may try to create an iframe with 0 height and width and border: none (basically an invisible iframe), point it to the needed URL and then the browser displays the certificate selection window.

I tested that in Firefox and Edge, both seems to work with that workaround.

发布者:admin,转转请注明出处:http://www.yc00.com/questions/1742273232a4413096.html

相关推荐

  • javascript - Send client certificate using XHR - Stack Overflow

    I'm trying to open an ssl service with java script.In order to do so, I need to send my certifica

    1天前
    30

发表回复

评论列表(0条)

  • 暂无评论

联系我们

400-800-8888

在线咨询: QQ交谈

邮件:admin@example.com

工作时间:周一至周五,9:30-18:30,节假日休息

关注微信