Bring back ‘pop-ups’ for Share and Follow plug-in
Making sharing sane again
Yes, it CAN be done I think
.
Share and Follow — a great WordPress plug-in! Let’s make it better
As we all know, recent browsers make doing ‘pop-ups’ difficult. So we’ve had to fall back on accepting entire new tabs opening for sharing stuff, when a nice ‘pop-up’ like the good old days would be sooo much nicer.
Well, fear not … I believe I’ve found the solution — and without using code injection for simulated windows or anything else complicated and troublesome like that.
The trick is to use the ‘modal=yes’ flag. Like so …
window.open('http://some.url','shareme','height=480,width=600,modal=yes,alwaysRaised=yes');
… and viola! It seems to work on all modern browsers. (You’ll need to test that yourself of course.)
See here for my example of the current plug-in (functions.php) modified to ‘pop up’ — well not quite. There’s a subtle difference! This doesn’t get caught/blocked by pop-up blockers (and shouldn’t ever) and doesn’t end up in a new tab either …
if($twitter=='yes')
{
if ($css_images=='yes'){$html .="<li class=\"".$list_style."\"><a rel=\"nofollow\" target=\"_blank\" class=\"twitter\" href=\"#\" onClick=\"var shareWin=window.open('http://twitter.com/home/?status=".urlencode($page_link)."','share','height=480,width=600,modal=yes,alwaysRaised=yes'); shareWin.focus(); return false;\" title=\"".sprintf(__('Tweet this %s - %s','share-and-follow'),pagepost($page_id),$page_title)."\"><span class=\"head\">".stripslashes ($twitter_share_text)."</span></a></li>";
}
if ($css_images=='no')
{
$html .="<li class=\"".$list_style."\"><a rel=\"nofollow\" target=\"_blank\" href=\"#\" onClick=\"var shareWin=window.open('http://twitter.com/home/?status=".urlencode($page_link)."','share','height=480,width=600,modal=yes,alwaysRaised=yes'); shareWin.focus(); return false;\" title=\"".sprintf(__('Tweet this %s - %s','share-and-follow'),pagepost($page_id),$page_title)."\"><img src=\"".WP_PLUGIN_URL."/share-and-follow/default/$size/twitter.png\" height=\"".$size."\" width=\"".$size."\" /> <span class=\"head\">".stripslashes ($twitter_share_text)."</span></a></li>";}
}
I’ve got this working on this site presently for Facebook and Twitter. Give it a go! If it doesn’t work for you, please let me know what browser you are using. Thanks!