JavaScript Changing url of one iframe from another change iframe from parent,change from iframe,change iframe on

I have a page with 2 iframe tags:

<iframe src="top.html" seamless="seamless" width=100% height=100% id="up" name="up" frameborder="0"></iframe>
<iframe src="main.html" seamless="seamless" width=100% height=800px id="main" frameborder="0"></iframe>

Inside main.html I have the following code:

parent.frames['up'].location.href = "top.html";

The idea is to refresh the "up" iframe. Sometimes it's working, sometimes nothing happens, and sometimes I get an exception:

Uncaught SecurityError: Blocked a frame with origin "null" from accessing a frame with origin "null". Protocols, domains, and ports must match.

What am I doing wrong?

Answer:1

Try below code:

parent.frames["up"].location.replace("top.html")
Answer:2

I have the following lines of code in my webpage - example/demo. HTML: <p data-toggle="modal" data-target="#messagesModal"><a href="#">Messages <span class="badge">2</span>&...

I have the following lines of code in my webpage - example/demo. HTML: <p data-toggle="modal" data-target="#messagesModal"><a href="#">Messages <span class="badge">2</span>&...

I have a table in html with only 1 column: My FILES. What I'm trying to reach: (a file explorer of a folder in the server) When the page loads in body onload i call an ajax function that add a row ...

I have a table in html with only 1 column: My FILES. What I'm trying to reach: (a file explorer of a folder in the server) When the page loads in body onload i call an ajax function that add a row ...

  1. ajax request getting cancelled chrome
  2. ajax request is getting canceled before it completes
  3. ajax request not getting response

I'm trying to incorporate a React component for radio buttons in my iOS app that's written in React Native, however I get an error when trying to import the component using the method that the author ...

I'm trying to incorporate a React component for radio buttons in my iOS app that's written in React Native, however I get an error when trying to import the component using the method that the author ...

  1. error in import statement in java
  2. import statement error in eclipse

I am trying to implement angular-translate in my application. So, I found the following JSFiddle which should demonstrate angular-translate, but I get the following error message: 'undefined' is ...

I am trying to implement angular-translate in my application. So, I found the following JSFiddle which should demonstrate angular-translate, but I get the following error message: 'undefined' is ...