I want to redirect to an external url after some action. Please refer my code
this.http.get(this.apiurl+'api/insert.php?did='+this.did).subscribe(data=>{
var jsonData = data.json();
let url = jsonData.urlpass;
// redirect to this url like https://flipkart.com with my affilate params
window.open(url ,'_blank');
});
this window.open(url ,'_blank');
shows the popup blocker.
So I tried like this
<a #myDiv id="anchorID" href="url here" target="_blank"></a>
$("#anchorID")[0].click();
But this click event is not triggered inside the subscribe method.
If I use var newWin = window.open();
newWin.location = url_pass;
It creates the error as Cannot assign to 'location' because it is a constant or a read-only property.
I want to open this external url in new window with out popupblocker issue.
Please help anyone.