My site using php and i create an online quiz and the quiz show in pop up mode.
Currently when i want to redirect my page using the script below. it goes to my homepage BUT it still at the pop up mode. I want it to close the pop up and go to homepage after I click finish.
How can I do that?
<script type="text/javascript">
window.parent.location = "../../../"
</script>
You can access the window that opened a popup with the
window.openerproperty on the popup. So, something like this should work:If you wanted to put that behavior in the
onclickevent on a submit button you’re building like this:You’d need to assign the String
window.opener.location.href='someUrl';window.close();to the variable$onclickbefore echoing the submit button out.