[原]iframe跨域访问解决方案
Posted by bianbian on 2007-08-24 03: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 做人要厚道
相关日志
Posted in JavaScript, Technology | 7 Comments »