FB share in new window

牧云@^-^@ 提交于 2019-12-07 08:28:43

问题


I've got FB share working with the following code:

<a target="_blank" href="http%3A%2F%2Fwww.facebook.com%2Fshare.php%3Fu%3Dhttp%3A%2F%2Fferalmotion.com%2Fshare%3Fwatch%3Dfd5f0c2"> 
<img src="/images/logo/facebook.png" alt="share on facebook"/> 
</a>

The problem is it opens in a full browser window. Does anybody know how I would get the share to open in the standard 500 x 360 pop-up window ???


回答1:


javascript will do the job.

<script type="text/javascript">
<!--
function myPopup(url) {
window.open( url, "myWindow", "status = 1, height = 500, width = 360, resizable = 0" )
}
//-->
</script>

<a target="_blank" href="javascript:myPopup('http%3A%2F%2Fwww.facebook.com%2Fshare.php%3Fu%3Dhttp%3A%2F%2Fferalmotion.com%2Fshare%3Fwatch%3Dfd5f0c2')"> 
<img src="/images/logo/facebook.png" alt="share on facebook"/> 
</a>



回答2:


use

<a href="javascript:window.open('http%3A%2F%2Fwww.facebook.com%2Fshare.php%3Fu%3Dhttp%3A%2F%2Fferalmotion.com%2Fshare%3Fwatch%3Dfd5f0c2', '_blank', 'width=400,height=500');void(0);">
<img src="/images/logo/facebook.png" alt="share on facebook"/>
</a>


来源:https://stackoverflow.com/questions/5653858/fb-share-in-new-window

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!