Can't access content of another frame in Chrome

后端 未结 4 476
感动是毒
感动是毒 2021-01-17 05:12

I have two frames. The pages in both frames come from the same domain (either localhost or a live domain - both using the same protocol).

The first frame needs to ac

4条回答
  •  攒了一身酷
    2021-01-17 06:18

    To address the anti-frameset comments: Being critical of those who use frames doesn't answer the question. Secondly there are things that frames do better than any other alternative.

    So the question shouldn't be, "What self-respecting web developer uses framesets?" It should be: "What self-respecting full featured browser doesn't support them properly?" and one of the answers is obviously Chrome.

    They've sprinkled "security flags" around various functions in their interpreter, including those that facilitate the transfer of certain information between pages in different frames. Consequently things like this don't work when run locally:

    top.frames[2].document.getElementById(ID)

    However when run on the server it will usually work fine.

    If you need it to work locally in Chrome you need to use some sort of workaround. You'll have to be creative. In some cases, like when you know the situation variables, you can create an array to handle the various possibilities ( which is a drag when it doesn't need to be that complex otherwise ).

提交回复
热议问题