Reputation: 51
I am using propeller ads smart direct link to go to an ad on download button click.What I would like to achieve is to open the ad in new tab on first click and after making sure that the ad is opened and on second click open the download page in a new tab. I am using this code :
Response.Write("window.open ('link','_blank');");
which I got from the internet but it gets blocked by the browser so on second click the user can open the download link if he allowed popup for the download link.
Upvotes: 0
Views: 350
Reputation: 51
OK I have found an answer to this. What I did :
In the Server Side Code I added on page load !ispostback a Viewstate and made its value false so the code will be :
if (!IsPostBack)
{
ViewState["isclicked"] = false;
}
On ServerSide Button clicked I checked if the viewstate is true or false If it is false go to ad and make the viewstate value false Else go to download page. Code:
if ((bool)ViewState["isclicked"] == false)
{
ViewState["isclicked"] = true;
Response.Redirect("ad direct link");
}
else
{
ViewState["isclicked"] = false;
Response.Redirect("download link");
}
Upvotes: 1