[原]iframe跨域访问解决方案
Posted by bianbian on 2007-08-24 15:09
本文Tags: iframe, JavaScript, 解决, 跨域
跨域访问提示“没有权限”,真是伤脑筋。研究几天以后,终于得到了所有解决方案。
如
A:www.bianbian.org
B:test.bianbian.org
C:www.other.com
从A跨域访问B、C,并能控制B、C的页面内容
方案(1)目标页面是自己的(即可以改页面输出),从A->B
最简单的,在B页面输出个
- <script>document.domain="www.bianbian.net";</script>
骗骗浏览器就行了
方案(2)目标页面是别人的,从A->C
比较头疼,只能用后台语言 2.1)做个proxy,2.2)做个JS输出(类似JSON方式了)
遵守创作共用协议,转载请链接形式注明来自http://bianbian.org 做人要厚道
September 25th, 2008 at 04:25:34
用代理是人都能想到,这压根就谈不上什么解决方案哦
November 20th, 2008 at 12:17:33
document.domain 是只读的,傻子。
November 20th, 2008 at 11:05:50
我不知道你是谁,连个名字也不敢留。
没试过就别乱说话,只会显出你水平和人品。
Anonymous Says:
November 20th, 2008 at 12:17:33 e
document.domain 是只读的,傻子。