(1)
It is because the website you are loading in your iframe is in a different domain than the one hosting the iframe itself.
See this: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Same_origin_policy_for_JavaScript
Thusly, the same origin policy will disallow Javascript to access/manipulate the page inside the iframe.
(2)
There is also a concept of sandboxing with HTML5, this attribute enables extra restrictions on the content that can appear in the inline frame. The tokens are: allow-same-origin, allow-scripts etc.
More Info: https://developer.mozilla.org/en-US/docs/Web/HTML/Element/iframe
Please check if your iframe is sandboxed?
(3)
Then, there is the X-Frame-Options HTTP response header, which can be used to indicate whether or not a browser should be allowed to render a page in an iframe. Sites can use this to avoid clickjacking attacks, by ensuring that their content is not embedded into other sites. It looks like this:
<meta http-equiv="X-FRAME-Options" content="SAMEORIGIN">
The tokens here can be: deny, sameorigin or allow-from.
More Info: https://developer.mozilla.org/en-US/docs/HTTP/X-Frame-Options
And: https://www.rfc-editor.org/rfc/rfc7034
Please check if your page has got such header?
(Lastly):
If all of the above don't apply to your scenario, then things should just work. Please post more information like the markup and your javascript.
iframes (or any other resource) when using thefile:///protocol is fraught with difficulty. This is for good security reasons. The simplest solution is to run a local web server.file:protocol. Ifhttpis being used then there should be no problems.