admin管理员组文章数量:1336659
I have a situation where a PC user's browser (I don't know which browser is it) doesn't have support for location.href
, .asp.
JavaScript is on. Cause fancyBox shows up login popup, which result is - location.href change to ./admin.php?act=loggedok (as example)
Can anybody tell me how to detect this and how to process this issue?
Is this possible to lock out this JS code?
location.href = "/";
I have a situation where a PC user's browser (I don't know which browser is it) doesn't have support for location.href
, http://www.w3schools./jsref/prop_loc_href.asp.
JavaScript is on. Cause fancyBox shows up login popup, which result is - location.href change to ./admin.php?act=loggedok (as example)
Can anybody tell me how to detect this and how to process this issue?
Is this possible to lock out this JS code?
location.href = "http://google./";
-
2
It doesn't sound like you know what the root cause is. I doubt it's
location.href
. – Stefan Kendall Commented Jul 1, 2011 at 13:24 - Yes, corporative clients - are great :( No information, - just "not works" :( – publikz. Commented Jul 2, 2011 at 23:42
- Dear Stefan. it sounds like i find an answer ... i was amazed, when understood this. Hmm, really sometimes it not work. In IE9 as ex. – publikz. Commented Feb 27, 2012 at 13:27
5 Answers
Reset to default 3the location object of the navigator is supported everywhere.. what you can do is to make a simple check if location is arround and then react to it as you need..
if ( window.location){ //or if (location in window) for modern browsers..
window.location.href="www.google.";
}
else{
alert("please enter www.google. into your address bar"); // :P
}
Btw; in a noscript tag, you cant do any javascript, so you cant "react to the user having javascript off". But you can display additional html in such a way, that shows the user he still lives in the 90's and should update his IE3 and enable javascript ;)
You need to be sure that Javascript support in user's browser is turned on. As you can see on w3schools web site it is supported by all main browsers.
This link can help: Mozilla: location
why don't you use
document.location.href = 'http://google./';
instead?
It works on all browsers unless they have javascript disabled
The problem is either that javascript is not supported, turned off, or the browser does not support the location object which is basically shorthand for window.location. thus use:
window.location.href="http://www.google.";
As Andron said all major browsers should support it unless they specifically have javascript disabled. You can tell the user about this using the <noscript>
tag.
本文标签: javascriptWhich browsers don39t support locationhref and how to process thisStack Overflow
版权声明:本文标题:javascript - Which browsers don't support location.href and how to process this? - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1742420278a2471518.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论