Open a new page when clicking a link in the same window

I want to open a page when a link is clicked in the same window. but the situation is that where the link was is the Popup Extender model. After the first click on the link, I close the model popup and open the page. I am trying 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>

      

+3


source to share


3 answers


I try this code and it worked successfully.

I first sent the control from the child page to the 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 first closed the model popup and then opened a new page on the parent page.

Thanks a lot for your cooperation.

0


source


You can also do this

window.location.assign(err);

      



Hope this is valuable information for you.

+1


source


function toPage(){
   window.open ("http://stackoverflow.com/",'newpage',true);
   window.location.href ="https://github.com/";       
   return false;
}

      

return required

0


source







All Articles