admin管理员组文章数量:1304166
I have a website for which I have implemented livechat, when user clicks on livechat link it opens a new window that is fine. I want to do is when no operator is online then it should not open a new window when livechat link clicked instead it should redirect to the contact us page of the website in the same window in the currently opened tab, Is it possible? I do not know how is it possible, what I have tried is this , it redirects to this page but opens in a new window.
window.location.replace('.php?route=information/contact');
I have a website for which I have implemented livechat, when user clicks on livechat link it opens a new window that is fine. I want to do is when no operator is online then it should not open a new window when livechat link clicked instead it should redirect to the contact us page of the website in the same window in the currently opened tab, Is it possible? I do not know how is it possible, what I have tried is this , it redirects to this page but opens in a new window.
window.location.replace('http://mywebsite./index.php?route=information/contact');
Share
Improve this question
edited Jan 18, 2017 at 21:47
Haroon
asked Jan 18, 2017 at 21:33
HaroonHaroon
5065 gold badges14 silver badges32 bronze badges
4
-
Why not
window.location = 'http://mywebsite./index.php?route=information/contact'
? – abeyaz Commented Jan 18, 2017 at 21:35 - Possible duplicate of What's the difference between window.location= and window.location.replace()? – Heretic Monkey Commented Jan 18, 2017 at 21:40
- window.location does not work for me! – Haroon Commented Jan 18, 2017 at 21:44
- Micheal2's solution works for me and I did not find it anywhere – Haroon Commented Jan 18, 2017 at 21:48
3 Answers
Reset to default 3The problem is somewhere in the code around that. You need to call that code in the old window.
If you want to call it in the chat window, try:
window.opener.location.replace('http://mywebsite./index.php?route=information/contact');
window.close()
Use the href
property instead:
window.location.href = 'http://mywebsite./index.php?route=information/contact';
You can use simple javascript code like this: window.location.href = "SOME URL" it will do the same think. .
本文标签: How to use windowlocationreplace in jquery or javascriptStack Overflow
版权声明:本文标题:How to use window.location.replace in jquery or javascript - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1741781340a2397330.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论