doubei5114 2012-12-22 14:08
浏览 41

PHP - 访问受密码保护的页面

I would just like to find a way in PHP (a link, a button, etc.) to give the user the possibility to open a (http-authentication-based) password protected page.

I already tried with a simple href containing the link to:

http://username:password@domain 

but it seems it does not work anymore in current browsers.

Is there a way to do this? It seems a very trivial problem, but actually I still have not found a way.

Thank you.

  • 写回答

2条回答 默认 最新

  • dongwan5381 2012-12-22 14:14
    关注

    Don't know why this should not work. Possible security issues that modern browsers are trying to avoid.

    But to get this done, you could use

        <script>
    function foo(){
    window.location = "http://username:password@domain";
    }
    </script>
    
        <a onclick='foo()'>Click here</a>
    
    评论

报告相同问题?

悬赏问题

  • ¥15 数学建模招标中位数问题
  • ¥15 phython路径名过长报错 不知道什么问题
  • ¥15 深度学习中模型转换该怎么实现
  • ¥15 HLs设计手写数字识别程序编译通不过
  • ¥15 Stata外部命令安装问题求帮助!
  • ¥15 从键盘随机输入A-H中的一串字符串,用七段数码管方法进行绘制。提交代码及运行截图。
  • ¥15 TYPCE母转母,插入认方向
  • ¥15 如何用python向钉钉机器人发送可以放大的图片?
  • ¥15 matlab(相关搜索:紧聚焦)
  • ¥15 基于51单片机的厨房煤气泄露检测报警系统设计