user2408368
user2408368

Reputation:

allowing pop ups with a alert

I am trying to get so that when a user clicks ok on the alert, it will allow pop ups for my site. My current code is:

var w = window.open( "urls","_blank", "height = 200, width = 300, top=450, left=1025" );
if(w == null || typeof(win) == "undefined" || win.location.href == 'about:blank') {
alert("You must allow pop ups before continuing, click the button to allow pop ups");
}

How may i achieve this please or if not possible, how can i achieve a way so that they can allow pop ups for my site easily with out having to ask them to allow by going in to the browsers settings.

Many thanks

Upvotes: 3

Views: 161

Answers (1)

Johann
Johann

Reputation: 293

Why don't just randomize the href in the anchor tag? Es:

<a href="" id="randLink" target="_blank">Open a random site</a>

Imagine a jquery function that: when the page is first loaded chooses one of your random sites and puts the link in the href of #randLink:

$(document).ready(function() {
    $('#randLink').attr('href',generateRandUrl());
});

and that on each click, changes the href value:

$( "#randLink" ).click(function() {
 $('#randLink').attr('href',generateRandUrl());
});

generateRandUrl() is a function that returns the string value of one of your websites

Upvotes: 1

Related Questions