简体   繁体   English

如何制作弹出式表单?

[英]How can I make a popup form?

I want to password protect my page which I am doing using LDAP bind authentication. 我想使用LDAP绑定身份验证来密码保护我的页面。 That whole process and script is fine. 整个过程和脚本都很好。 Now I have this form which submits to that script and that script checks whether the user has authentication or not, if they don't it kicks them out. 现在,我有了此表单,该表单将提交给该脚本,并且该脚本将检查用户是否具有身份验证,如果没有,则将其踢出。

What I am trying to do here is this. 我在这里想要做的就是这个。 http://jsfiddle.net/s5JyR/ that form I have there, I would like to make that a popup login instead so as soon as a user goes to the url of the site they get a blank page with a POPUP screen asking for the login. 我在那里的http://jsfiddle.net/s5JyR/表单,我想使之成为弹出式登录名,这样,一旦用户转到该网站的网址,他们就会得到一个空白页面,并带有一个POPUP屏幕,要求登录名。 How can I do make that popup? 我该如何做弹出窗口? if the user clicks cancel it should display Error. 如果用户单击“取消”,则应显示“错误”。 Access denied. 拒绝访问。 Or if the user inputs the wrong login credentials display that same error message. 或者,如果用户输入了错误的登录凭据,则会显示相同的错误消息。 The error messages don't need to be a popup, they can be displayed on a different blank page. 错误消息不必弹出,它们可以显示在不同的空白页上。 All the forms I have looked around Google have a popup from a button which isn't what I want.. 我在Google周围浏览过的所有表单都有一个我不想要的按钮弹出窗口。

I am trying to make something like this: 我正在尝试做这样的事情:

在此处输入图片说明

In Javascript you can do that by opening a new Window with the window.open() method, opening an URL with the form and then capturing its information from outside. 在Javascript中,您可以通过使用window.open()方法打开一个新窗口,使用表单打开URL,然后从外部捕获其信息来做到这一点。 But that might fail in platforms not supporting it. 但这在不支持它的平台上可能会失败。

Another method can be showing the form in a floating box, but it is still Javascript dependant. 另一种方法可以在浮动框中显示该表单,但仍取决于Javascript。

Maybe what you actually want is an HTTP login form, it is not Javascript but it does exactly what you ask for. 也许您真正想要的是一个HTTP登录表单,它不是Javascript,但它确实满足您的要求。 Though you will have to handle everything server-side. 尽管您将不得不处理服务器端的所有事情。

Take a look at HTTP Authentication with PHP to learn about this. 查看使用PHP的HTTP身份验证以了解此内容。
...Assuming that you have PHP for server side scripting, if not, it is still a good reference that you can not-so-differently implement in other languages. ...假设您拥有用于服务器端脚本的PHP,如果没有,那它仍然是一个很好的参考,您不能以其他语言来实现。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM