Window.open Blocked By Default (popups Blocked)
I am trying to have share link for my site and had following code: function handleFacebook(shortURL) { $('.facebook').click(function(e) { e.preventDefault(); window.ope
Solution 1:
You want to added many share links right ? and because the browser will blocked popup if you not include window.open
in link href
.
So you have to create entire of link with window.open
in its href
like this one.
Example: FIDDLE
var url = ['http://google.com', 'http://bing.com', 'http://duckduckgo.com/'];
$.each(url, function(i, val){
$('body').append('<div><a href="#" onclick="window.open(\'https://www.facebook.com/sharer/sharer.php?u=\'+encodeURIComponent(\''+val+'\'), \'facebook-share-dialog\', \'width=626,height=436\'); return false;"> Share on Facebook </a></div>');
});
Post a Comment for "Window.open Blocked By Default (popups Blocked)"