0

I am opening an url in iframe. That page has form to fill by user. When user fill the form, I want to reload the main website (outside the iframe) to be reload. Or if I can trigger a outside javascript function with in iframe.

I am working with ReactJs.

Ex. I have 2 Websites A and B. I am opening a specific url of site B in A using iframe. When user submit the form in ifram. I want to reload the web page of site A using javascript. When I try window.location.reload(), window.parent.location.reload(). they all reload iframe.

halfer
  • 19,824
  • 17
  • 99
  • 186
Tony Stark
  • 21
  • 6
  • https://stackoverflow.com/questions/954454/how-to-reload-main-page-from-within-an-iframe/22933484 – Nitha Nov 28 '18 at 04:25
  • Please read [Under what circumstances may I add “urgent” or other similar phrases to my question, in order to obtain faster answers?](//meta.stackoverflow.com/q/326569) - the summary is that this is not an ideal way to address volunteers, and is probably counterproductive to obtaining answers. Please refrain from adding this to your questions. – halfer Nov 28 '18 at 18:52

1 Answers1

0

Have you tried using

window.location.assign(url);

and just adding the url of the original page? window.location.reload() is just refreshing the page, so if you open a new page refreshing it is still going to keep you on that page.

Joseph
  • 16
  • 8
  • I tried it and getting following error: Uncaught DOMException: Blocked a frame with origin from accessing a cross-origin frame Javascript don't allow to access cross origin. – Tony Stark Nov 29 '18 at 06:23
  • Maybe try something like `document.domain ="url.html";` and see if that works – Joseph Nov 29 '18 at 12:39