This is a common problem related to cross-origin.
I have a Page base.html with window.open('foo.html')
and foo.html with a JavaScript function called faa()
.
base.html and foo.html are in the same domain (in this example, in the same directory too).
Have a look at this code:
<script>
var opened_foo;
$('#openfoo').click(function() {
opened_foo= window.open('foo.html','_blank');
});
$('#dofaa').click(function() {
opened_foo.faa("hello");
});
</script>
The command opened_foo
produced an error:
Uncaught DOMException: Blocked a frame with origin "null" from accessing a cross-origin frame.
The error is pretty simple. My base.html seems to not have an "origin". But why? What do I need to do?