[英]How to redirect chrome browser to its set homepage using javascript?
I am trying to use javascript to redirect to browsers homepage when users logoff a web application.当用户注销 web 应用程序时,我正在尝试使用 javascript 重定向到浏览器主页。 I got this working in IE using window.location.href = "about:home"
我在 IE 中使用window.location.href = "about:home"
However for Chrome and Edge it is not working.I tried window.home();
但是对于 Chrome 和 Edge,它不起作用。我试过window.home();
and it does not work too.它也不起作用。
Please help me with this.Thank you for your answers.请帮帮我。谢谢您的回答。
Try this one line solution supporting all the major browsers:试试这个支持所有主要浏览器的单行解决方案:
window.location.href = browser == 'gc' ? 'chrome://newtab/' : browser == 'op' ? 'about:speeddial' : browser=='sa' ? 'http://livepage.apple.com' : 'about:home';
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.