bianbian coding life

便便代码人生: 关注技术, 翻译文档, 偶尔动动手

[原]iframe跨域访问解决方案

Posted by bianbian on 2007-08-24 15:09

本文Tags: , , ,

跨域访问提示“没有权限”,真是伤脑筋。研究几天以后,终于得到了所有解决方案。

A:www.bianbian.org
B:test.bianbian.org
C:www.other.com
从A跨域访问B、C,并能控制B、C的页面内容

方案(1)目标页面是自己的(即可以改页面输出),从A->B
最简单的,在B页面输出个

  1. <script>document.domain="www.bianbian.net";</script>

骗骗浏览器就行了

方案(2)目标页面是别人的,从A->C
比较头疼,只能用后台语言 2.1)做个proxy,2.2)做个JS输出(类似JSON方式了)

标签: , , ,

遵守创作共用协议,转载请链接形式注明来自http://bianbian.org 做人要厚道

相关日志

6 Responses to “[原]iframe跨域访问解决方案”

  1. Anonymous Says:

    用代理是人都能想到,这压根就谈不上什么解决方案哦

  2. Anonymous Says:

    document.domain 是只读的,傻子。

  3. bianbian Says:

    我不知道你是谁,连个名字也不敢留。
    没试过就别乱说话,只会显出你水平和人品。
    Anonymous Says:
    November 20th, 2008 at 12:17:33 e
    document.domain 是只读的,傻子。

  4. wrong Says:

    我也在找办法,就是找不到

  5. Anonymous Says:

    document.domain的确是只读的,诚意奉劝楼主:自己傻不打紧,出来糊弄人就不对了。

  6. bianbian Says:

    楼上的还是同一个人吧?自己看吧。有些人就是没人品,没办法。
    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.

Leave a Reply

XHTML: You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <code> <em> <i> <strike> <strong>

(required)