在我目前的双因素认证实施中,我通过链接向用户发送短信。 当链接被点击时,登录在用户机器上进行。
但是,在电话上,浏览器会打开一个空白页面(因为我目前正在从SMS服务器返回204来查看SMS中单击的链接。
我想要发生的是,当用户点击SMS中的链接时,broser根本不会打开。 它只需发送GET请求,用户就不必关闭手机上的浏览器窗口。
如果这是不可能的,是否有可能使打开的窗口立即自动关闭?
In my current implementetion of two-factor auth, I'm sending a SMS to the user with a link. When the link is clicked, the login proceedes on the users machine.
However, on the phone the browser will open up a empty page (since I'm currently returning 204 from the webserver for the link clicked in the SMS.
What I would like to happen is that when the user clicks the link in the SMS, the broser is not opened at all. It should just send the GET request, and the user will not have to close the browser window on his phone.
If that is not possible, is it possible to make the window that get's opened to autoclose imediately?
最满意答案
浏览器必须打开才能发出请求。 对此你无能为力。
但是,如果您控制来自Web服务器的内容,则可以尝试加载window.close() 。 实际上,您可能会被阻止,并且还应该有一个类似于“已登录,请关闭此窗口”的回退内容。 (你可以在点击按钮时调用window.close() 。)
The browser has to open to make the request. There's nothing you can do about this.
However, if you control the content from the web server, you can attempt a window.close() on-load. Realistically, you'll probably get blocked on this and should also have a fallback content that says something like, "logged in, please close this window". (You can probably call window.close() on a button click.)
更多推荐
SMS,用户,打开,link,电脑培训,计算机培训,IT培训"/> <meta name="description&qu
发布评论