[原]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 是只读的,傻子。
January 30th, 2009 at 07:26:40
我也在找办法,就是找不到
March 28th, 2009 at 04:47:40
document.domain的确是只读的,诚意奉劝楼主:自己傻不打紧,出来糊弄人就不对了。
March 29th, 2009 at 04:38:17
楼上的还是同一个人吧?自己看吧。有些人就是没人品,没办法。
http://msdn.microsoft.com/en-us/library/cc196989(VS.85).aspx
domain Property
Sets or gets the security domain of the document.
Syntax
[ sDomain = ] object.domainPossible Values
sDomain String that specifies or receives the domain suffix.
The property is read/write. The property has no default value.
August 20th, 2009 at 05:24:53
呵呵,不同浏览器不同……有些确实是只读的……
微软只是一家之言……