<rt id="bn8ez"></rt>
<label id="bn8ez"></label>

  • <span id="bn8ez"></span>

    <label id="bn8ez"><meter id="bn8ez"></meter></label>

    Ginew.Z 的博客

    一切,為了讓生活更簡單、更自然

      BlogJava :: 首頁 :: 聯系 :: 聚合  :: 管理
      21 Posts :: 0 Stories :: 14 Comments :: 0 Trackbacks

    以前如果要使iframe里面的腳本能訪問parent的內容,但iframe和parent的二級域名相同,那一般都會在兩者都寫上document.domain="xxx.com" 以放寬訪問權限。

    今天發現,如果iframe和parent在同一個三級域名下,比如都是aa.bb.com,那設了document.domain反而會造成訪問拒絕。

    查了下MSDN,有如下解釋:

    Remarks

    The property initially returns the host name of the server from which the page is served. The property can be assigned the domain suffix to allow sharing of pages across frames. For example, a page in one frame from home.microsoft.com and a page from www.microsoft.com initially would not be able to communicate with each other. However, by setting the domain property of both pages to the suffix "microsoft.com", you ensure that both pages are considered secure and access is available between the pages.

    When you set the domain property, use the domain name determined by the server rather than by the client browser.

    All the pages on different hosts must have the domain property explicitly set to the same value to communicate successfully with each other. For example, the value of the domain property of a page on the host microsoft.com would be "microsoft.com" by default. It might seem logical that if you set the domain property of a page on another host named msdn.microsoft.com to "microsoft.com," that the two pages could communicate with each other. However, this is not the case unless you have also explicitly set the domain property of the page on microsoft.com to "microsoft.com".

    Furthermore, this property cannot be used to allow cross-frame communication among frames with different domain suffixes. For example, a page in one frame from www.microsoft.com and a page in another frame from www.msn.com would not be able to communicate with each other even if the domain property of both pages was set to the suffix "microsoft.com".

    security note Security Alert??Using this property incorrectly can compromise the security of your Web site. Set the domain property only if you must allow cross-domain scripting. Use a value determined on the server. Setting this property to a value determined on the client (like through the location object) could expose your site to attack from another site through Domain Name System (DNS) manipulation. For more information, see Security Considerations: Dynamic HTML.

    For more information on domain security, see About Cross-Frame Scripting and Security.

    posted on 2006-04-13 11:54 無風之雨 閱讀(9361) 評論(3)  編輯  收藏 所屬分類: JavaScript

    Feedback

    # re: document.domain與域名的問題 2012-07-26 13:48 問學堂
    嗯,學習了,謝謝!  回復  更多評論
      

    # re: document.domain與域名的問題 2012-07-29 18:02 jdwx
    document.domain跨域問題,學習了,謝謝。  回復  更多評論
      

    # re: document.domain與域名的問題 2013-05-31 08:03 lsb
    好值得學習  回復  更多評論
      

    主站蜘蛛池模板: 亚洲乱码无限2021芒果| 亚洲婷婷国产精品电影人久久| 亚洲人成电影在线天堂| 久久久精品视频免费观看 | 日韩一级免费视频| 亚洲最大中文字幕无码网站| aa级一级天堂片免费观看| 亚洲乱码卡一卡二卡三| 国产麻豆视频免费观看 | 亚洲中文字幕久久精品蜜桃| 无码一区二区三区AV免费| 亚洲色成人四虎在线观看| 免费无码又爽又高潮视频| 亚洲综合小说另类图片动图| 成年在线观看免费人视频草莓| 亚洲熟妇AV乱码在线观看| 国产传媒在线观看视频免费观看 | 国产又大又粗又长免费视频| 亚洲高清免费在线观看| 69成人免费视频| 亚洲成av人在线观看网站| 亚洲Av无码乱码在线znlu| 你好老叔电影观看免费| 亚洲第一页在线视频| 免费看AV毛片一区二区三区| 三级片免费观看久久| 亚洲国产精品国自产拍AV| 114一级毛片免费| 精品久久亚洲一级α| 国产亚洲精品a在线无码| 久久受www免费人成_看片中文| 亚洲AV无码一区二区三区性色 | 亚洲精品国产精品| 亚洲精品无码日韩国产不卡?V| 国内精品免费视频精选在线观看| 亚洲视频一区在线观看| 国产在线19禁免费观看国产| 男人天堂免费视频| 亚洲一卡2卡3卡4卡乱码 在线| 亚洲va中文字幕无码| 69影院毛片免费观看视频在线 |