使用jQuery关闭“移动浏览器"窗口 [英] Close the Mobile browser window using jQuery
问题描述
我已经使用asp.net mvc3和jQuery mobile开发了一个移动网站.我想通过允许用户单击退出"按钮来处理退出事件.
I have developed a mobile site using asp.net mvc3 and jQuery mobile. I want to handle the signout event by allowing the user to click the SignOut button.
任何人都可以通过单击退出"按钮来帮助我关闭移动浏览器窗口.我尝试了以下代码:
Can anyone help me to close the mobile browser window on click of the SignOut button. I tried the folliwng code:
window.close();
使用View中嵌入的javascript,但它仅适用于IE浏览器,不适用于Safari和FireFox.
Using the javascript embedded in the View, but it is working for the IE browsers only not for the Safari and FireFox.
感谢&问候, Santosh Kumar Patro
Thanks & Regards, Santosh Kumar Patro
推荐答案
这是使用脚本关闭浏览器的唯一方法,因此,如果该方法无效,则无法完成.
That's the only way that you can close the browser using script, so if that doesn't work, it can't be done.
大多数桌面浏览器会要求用户确认是否尝试使用脚本关闭窗口.显然,一些移动浏览器无需确认即可允许它,而某些浏览器无需询问用户即可忽略它.
Most desktop browsers will ask the user to confirm if you try to close the window using script. Apparantely some mobile browsers allow it without confirmation, and some ignore it without asking the user.
这篇关于使用jQuery关闭“移动浏览器"窗口的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!