I want to open a page on click of a link on same window. but the situation is that where the link resided is an Model Popup Extender. After clicking on the link first I close the Model Popup and then open the page. I try two methods.
<script language="javascript" type="text/javascript">
function showMessage(err) {
parent.document.getElementById("div1").style.visibility = "hidden";
window.location.href = err; //does't give any result.
window.open (err,'_self',true);//open page in new tab
}
</script>
You can do like this as well
window.location.assign(err);
Hope this is valuable information to you.
function toPage(){
window.open ("http://stackoverflow.com/",'newpage',true);
window.location.href ="https://github.com/";
return false;
}
return is required
I try this code and it successfully worked.
Firstly I sent the control from Child page to parent page, using this code.
<script language="javascript" type="text/javascript">
function openpage(pageurl) {
parent.openNewPage(pageurl);//call a function of parent page
}
</script>
<script language="javascript" type="text/javascript">
function openNewPage(pageurl)
{
window.open(pageurl,"_self","");
}
</script>
It closed first the Model Popup and then opened the new page on parent page.
thanks a lot all, for your co-operation.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.