Every version of IE opening links in new window

只谈情不闲聊 提交于 2019-12-11 03:15:03

问题


I've been designing a website and have been using Safari and Chrome for most of the testing. I just tried testing Firefox and that went smoothly too. Leave it to IE to throw in a wrench.

For some reason, every link opens a new window, for every single version from IE 6 to IE 10. In the metro version of IE 10, they open in new tabs.

My only thought is that I didn't specify the target="_self", but shouldn't that be implied? Is there a solution without adding target="_self" to every single link in my website?


回答1:


I had the same problem with my Links. The problem is the leading / (slash) in /basedir/controller/action. The solution is to define a <base> tag in your HTML head.

You can automate this tag for testing => production environment if you'r using YII:

<?php echo '<base href="'.$this->createAbsoluteUrl('/').'/" />'.PHP_EOL; ?>

You can even define a target in your <base> tag: target="_self"




回答2:


Thank you for all your suggestions. I was able to hop on a physical computer's version of IE, and while certain links are still broken, they do not open in new windows.

I guess this is just an issue with browserstack.com. But considering browserstack is a website specifically designed to test browsers on native operating systems, this really is something they should look into.



来源:https://stackoverflow.com/questions/15913804/every-version-of-ie-opening-links-in-new-window

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!