Is it likely that future releases of Chrome suppor

2019-01-28 22:13发布

问题:

When I make a local html load another local html file in a iFrame (frame.src=) in Chrome, I cannot access its document through contentWindow or contentDocument (even with the verification of contentWindow being the document itself) because it seems Chrome doesn't allow it when a local html file is involved. Is it possible that this feature will change in next releases of Chrome? Note: it works (contentDocument or contentWindow) with Safari and Opera, IE, WebKit. It seems to be a security issue but contentDocument and contentWindow are from W3C.

回答1:

It is because of Chrome restriction known as Same-Origin Policy. By default the local files are considered to belong to different origins and not allowed to access one from another. To solve the issue, you can launch the Chrome application with the --allow-file-access-from-files command-line switch.