Cross Domain Update

I am trying to update a parent window from a child window. Using the following code in the Child window, this code is in HTML widgets.

parent.parent.window.opener.location.reload()

I am not adding any code to the parent page, as this is a PHP moodle page. This code works fine if both windows are in the same source. I do not want to go with post-message(). because I do not want to touch the parent window code. Can you help me? Just to refresh the page!

+4
source share
2 answers

Finally, I found a solution for this work.

1) You need to put in the HTML file below the code in the domain where the parent page is located. pageReload.html

<!DOCTYPE html>
<html>
<head>
<script type="text/javascript" src="http://code.jquery.com/jquery-1.11.3.js"></script>
<script type="text/javascript">
function reload() {
     parent.parent.window.opener.location.reload();
};
</script>
</head>
<body onload="reload()">
</body>
</html>

2) HTML- HTML-. .

window.location = "http://www.yourparentdomain.com/pageReload.html";

.

+2

Source: https://habr.com/ru/post/1663622/