How to set the

前端 未结 4 2098
天涯浪人
天涯浪人 2020-11-30 13:30

I would like to display the image from a network camera on my web page, but the image is behind a HTTP basic authentication server.

In Firefox and Chrome I can do th

相关标签:
4条回答
  • 2020-11-30 14:02

    See http://support.microsoft.com/kb/834489 and http://msdn.microsoft.com/en-us/library/ie/ee330735(v=vs.85).aspx#login_creds_urls

    Long story short, usernames/passwords are not formally supported under the HTTP/HTTPS protocol schemes and due to their use in phishing attacks, they were disabled in IE6 on XPSP2. Support can be manually re-enabled by the user using a registry override (FEATURE_HTTP_USERNAME_PASSWORD_DISABLE) but this is not recommended.

    0 讨论(0)
  • 2020-11-30 14:07

    Best way is to create a login page, then setup port forwarding on your router to display the camera. Does the camera come with web software?

    0 讨论(0)
  • 2020-11-30 14:19

    You can load your img with AJAX, using XMLHttpRequest. As you might know, XMLHttpRequest has a setRequestHeaders method, so you will be able to manipulate headers for your request, hence, you will be able to do basic HTTP authentication.

    0 讨论(0)
  • 2020-11-30 14:23

    Bottom line: Not all browsers allow this. It may work in some but not others.

    But as someone else has said already, it's not very safe -- you're effectively giving the login and password details to anyone who browses the page. Not good.

    A better option would be proxy it through the same server that you're providing the html code from, then the href in the <img> tag could just be a local URL, and no-one need know where the image is actually coming from.

    0 讨论(0)
提交回复
热议问题