简体   繁体   中英

javascript - reload facebook share dialog while opening it

i know, it is a bit weird question, but I really want to reload facebook share dialog twice after it opens. the reason is that the page to share is new and thats why share dialog doesnot show the og image. only when I reopen the share dialog twice or thrice, then og image shows up.

I need that it shows up in the first share dialog.

I tried:

function shareFB(url) {
 var newwindow = window.open('https://www.facebook.com/sharer/sharer.php?u=' + encodeURIComponent(url),
              'facebook-share-dialog',
                'width=572,height=567');
 newwindow.location.reload(true);
 newwindow.location.reload(true);
}

but it does not have any effect...

any ideas?

ok the solution was just simply to define:

<meta property="og:image:width" content="1200"/>
<meta property="og:image:height" content="630"/>

and it loads image on the first load

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM