samedi 25 avril 2015

Open window in new tab without user event


Here I have two asp.net mvc websites . From first website i have one link to second website. So first website will call the second's action. I want to open on page in new tab and current tab should redirect to my first website. This action will return one view.

My approaches in view

  1.   $(document).ready(function (e) {
            window.open("/newpage");
            window.open("/site1", "_self");
    
      });
    
    

    Browser popup blocker will block this. Because there is no user event . So I tried different approach

2 $(document).ready(function (e) {

    $("#input").on("click", function () {


        window.open("/newpage");
        window.open("/site1", "_self");
    });
    $("#input").trigger("click");


});

test one

I have created triggered one event. But still its blocked. This two approaches is working fine if popup blocker is disabled. I want to open page in new tab without disable the popup blocker.

NOTE: This two website comes under same domain name . eg: abc.com\siteone and abc.com\sitetwo


Aucun commentaire:

Enregistrer un commentaire