javascript - Reload a page inside iframe -


I have an iframe and I want to reload the currently displayed page by pressing the button .

HTML:

  & lt; Iframe id = "webView" & gt; & Lt; / Iframe & gt;  

JS:

  function reload page () {var webView = document.getElementById ("webview"); // CODE}  

under the reload page () method I tried various solutions:

reloading the call < / H2>
  webView.contentWindow.location.reload ();  

This does not work because the pages loaded inside iFrame are from a different domain than the main page.

set

  webView.src = wevView.src;  

This returns the wrong result because it contains the initial URL which I set on an iframe, not currently.

Set the location

  webView.contentWindow.location = webView.contentWindow.location  

I get it from a different domain with the URL Expecting not to work (similar to calling for reloading), but in fact it works and it also gives a good result.
Good, but not correct: The location object contains the current URL, but no parameter strips. For example if the frame is currently displayed in the following url:

  http://www.myserver.com/thatsite/?page_id=11  

< Code> Location object contains this URL:

  http://www.myserver.com/thatsite/  

then this one Good works unless there is no criteria URL.

Better solution?

I rely heavily on the URL with parameters (mostly wordpress installation), so I need a way to keep them while reloading.
Does anyone know any solution to achieve this?

Not just possible, see this thread:

< P> and this one


Comments

Popular posts from this blog

sqlite3 - UPDATE a table from the SELECT of another one -

c# - Showing a SelectedItem's Property -

javascript - Render HTML after each iteration in loop -