簡體   English   中英

Facebook分享使用php和javascript生成白頁/空白頁

[英]facebook share producing white / blank page with php and javascript

好的,基本上,當我嘗試使用新的和sharer.php版本的Facebook共享按鈕時,我得到的是白頁

我正在嘗試共享如下所示的網址: https : //www.facebook.com/sharer/sharer.php? u =https :// * * .com / 3e68ec7f58134f66d09a1c05c2783385 / index.html

現在,如果我粘貼到新的瀏覽器窗口中,或者什至刷新白色/黑色頁面,頁面也可以正常加載

這是我的代碼:

<!DOCTYPE html>
<html>
<head>
<style type="text/css">
body {
    overflow:hidden;
}
</style>
<link rel="stylesheet" href="onlinedojo/css/layout.css" type="text/css" media="screen" />
<script src="js/jquery-1.5.2.min.js" type="text/javascript"></script>
<script src="onlinedojo/js/hideshow.js" type="text/javascript"></script>
<script src="onlinedojo/js/jquery.tablesorter.min.js" type="text/javascript">    </script>
<script type="text/javascript" src="onlinedojo/js/jquery.equalHeight.js"></script>
<title>post</title>
</head>
<body>
<div id="fb-root"></div>
<script>
function postToFb(){
window.open('<?php echo $fburl ?>','1317220786706','width=400,height=400,toolbar=0,menubar=0,location=0,status=1,scrollbars=1,resizable=1,left=0,top=0');
    window.close();
    return false;
}
</script>
<form class="submit_link" style="float:right">
                &nbsp;<input type="submit" class="alt_btn"     value="Share on Facebook" onclick="postToFb();" />
            </form>
</body>
</html>

任何幫助將不勝感激-這讓我發瘋了!

好吧,你試試這個

<script>
    function postToFb(url) {
        window.open(url, '_blank', 'width=530,height=460,left=' + (screen.availWidth / 2 - 250) + ',top=' + (screen.availHeight / 2 - 250) + '');
        return false;
    }

<?php 
    $title = urlencode('your title');
    $summary = urlencode('your sumary');
    $url_base = urlencode('url to share');
    $url_image = urlencode('thumbnail url');
    $url_to_share = "http://www.facebook.com/sharer/sharer.php?s=100&p[title]=$title&p[summary]=$summary&p[url]=$url_base&p[images][0]=$url_image";
?>

postToFb('<?php echo urlencode($url_to_share) ?>') {

</script>

希望對您有所幫助。

您不需要此處的表單或提交按鈕。 因此,只需刪除表單和按鈕,然后放置簡單的共享鏈接,然后嘗試一下

HTML:

<a href="javascript: void(0)" onClick="fbpopup('<?php echo urlencode($fburl); ?>')">
 Share on Facebook
</a>

Java腳本

<script>
function fbpopup(popwhat) {
window.open( popwhat, "fbshare", "height=380,width=660,resizable=0,toolbar=0,menubar=0,status=0,location=0,scrollbars=0" )
} 
</script>

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM