admin管理员组文章数量:1023782
I am using the above 2 mands on my website. It seems they work for 95% of people visiting the page it should trigger but for others it doesn't.
Does anyone know if these javascript mands can be blocked at all? I am having a real headache finding out why they don't work sometimes.
p.s I am not using these for spam or anything, just for processing payments.
Thanks.
EDIT: I have a tag replacement for JS being disabled. I am thinking more of a random blocking that a user isn't generally aware of. None of the people who have reported the issue would be likely to install a pop up blocker
I am using the above 2 mands on my website. It seems they work for 95% of people visiting the page it should trigger but for others it doesn't.
Does anyone know if these javascript mands can be blocked at all? I am having a real headache finding out why they don't work sometimes.
p.s I am not using these for spam or anything, just for processing payments.
Thanks.
EDIT: I have a tag replacement for JS being disabled. I am thinking more of a random blocking that a user isn't generally aware of. None of the people who have reported the issue would be likely to install a pop up blocker
Share Improve this question edited Jun 30, 2011 at 7:56 webnoob asked Jun 30, 2011 at 7:45 webnoobwebnoob 16k13 gold badges87 silver badges169 bronze badges 9- There is no location property of the HTMLDocument interface, perhaps you are confusing it with window.location. What "mands" are you using? What is it that "works for 95% of people"? – RobG Commented Jun 30, 2011 at 7:55
- In terms of this not working, make sure the 5% aren't all using the same browser, if they are, you can link it to specific browser behaviour. – Abe Petrillo Commented Jun 30, 2011 at 7:56
- The information I get back is VERY vague. Most of the people using the site are non technical and when you ask what browser, they say windows ... – webnoob Commented Jun 30, 2011 at 7:57
- @RobG - Well it works normally ... Why would that happen? – webnoob Commented Jun 30, 2011 at 7:59
- Yes some anti virus softwares might block JavaScript as "additonal security" so ask those clients what kind of Anti Virus they have installed or protection programs. – user447356 Commented Jun 30, 2011 at 8:05
3 Answers
Reset to default 4Use window.location
instead of document.location
for full support across all browsers.
Are you using iframes? That's the only reason you should use window.parent
or else window.parent
just points to the current window.
If you're running this code inside of an iframe to change the parent windows locations (window.parent.location
) - it will only work on the same domain. If the domains are different your code will fail.
There are work arounds to getting subdomain support working using document.domain
but I'm already making too many assumptions in what your issue is.
Anything on the client side can be blocked. Two examples:
- Simply disable javascript in your browser
- Use a plugin which disables certain Javascript actions (something like TamperData for Firefox)
As RobG said in a ment, document.location is not part of a standard, though implemented in some browsers. I think you should be using window.location. See the notes in this mozilla reference on document.location that say document.location used to be a read-only property and is non-standard and window.location is remended instead.
parent.location can be blocked by same-origin security settings if you're framed and the parent frame is not the same origin as your frame.
I am using the above 2 mands on my website. It seems they work for 95% of people visiting the page it should trigger but for others it doesn't.
Does anyone know if these javascript mands can be blocked at all? I am having a real headache finding out why they don't work sometimes.
p.s I am not using these for spam or anything, just for processing payments.
Thanks.
EDIT: I have a tag replacement for JS being disabled. I am thinking more of a random blocking that a user isn't generally aware of. None of the people who have reported the issue would be likely to install a pop up blocker
I am using the above 2 mands on my website. It seems they work for 95% of people visiting the page it should trigger but for others it doesn't.
Does anyone know if these javascript mands can be blocked at all? I am having a real headache finding out why they don't work sometimes.
p.s I am not using these for spam or anything, just for processing payments.
Thanks.
EDIT: I have a tag replacement for JS being disabled. I am thinking more of a random blocking that a user isn't generally aware of. None of the people who have reported the issue would be likely to install a pop up blocker
Share Improve this question edited Jun 30, 2011 at 7:56 webnoob asked Jun 30, 2011 at 7:45 webnoobwebnoob 16k13 gold badges87 silver badges169 bronze badges 9- There is no location property of the HTMLDocument interface, perhaps you are confusing it with window.location. What "mands" are you using? What is it that "works for 95% of people"? – RobG Commented Jun 30, 2011 at 7:55
- In terms of this not working, make sure the 5% aren't all using the same browser, if they are, you can link it to specific browser behaviour. – Abe Petrillo Commented Jun 30, 2011 at 7:56
- The information I get back is VERY vague. Most of the people using the site are non technical and when you ask what browser, they say windows ... – webnoob Commented Jun 30, 2011 at 7:57
- @RobG - Well it works normally ... Why would that happen? – webnoob Commented Jun 30, 2011 at 7:59
- Yes some anti virus softwares might block JavaScript as "additonal security" so ask those clients what kind of Anti Virus they have installed or protection programs. – user447356 Commented Jun 30, 2011 at 8:05
3 Answers
Reset to default 4Use window.location
instead of document.location
for full support across all browsers.
Are you using iframes? That's the only reason you should use window.parent
or else window.parent
just points to the current window.
If you're running this code inside of an iframe to change the parent windows locations (window.parent.location
) - it will only work on the same domain. If the domains are different your code will fail.
There are work arounds to getting subdomain support working using document.domain
but I'm already making too many assumptions in what your issue is.
Anything on the client side can be blocked. Two examples:
- Simply disable javascript in your browser
- Use a plugin which disables certain Javascript actions (something like TamperData for Firefox)
As RobG said in a ment, document.location is not part of a standard, though implemented in some browsers. I think you should be using window.location. See the notes in this mozilla reference on document.location that say document.location used to be a read-only property and is non-standard and window.location is remended instead.
parent.location can be blocked by same-origin security settings if you're framed and the parent frame is not the same origin as your frame.
本文标签: javascriptdocumentlocationparentlocationCan they be blockedStack Overflow
版权声明:本文标题:javascript - document.locationparent.location - Can they be blocked? - Stack Overflow 内容由热心网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://it.en369.cn/questions/1745588250a2157731.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论