Attaching text to the twitter sharing link

2019-07-28 18:59发布

I'm trying to figure out how I can output the string of text Try this recipe at the beginning of this twitter sharing function. So when you click the button to share it will say "Try this recipe" then have the url etc. Thank you.

function load_twitter() {
    var load = window.open('http://twitter.com/share?url='+ window.location.href +'&via=atsbyvermouth','','scrollbars=no,menubar=no,height=450,width=650,resizable=yes,toolbar=no,location=no,status=no');
}

1条回答
一纸荒年 Trace。
2楼-- · 2019-07-28 19:19

It's very simple, just add this text=Try this recipe& at first, i.e.

function load_twitter() { 
    window.open('http://twitter.com/share?text=Try this recipe&url='+ window.location.href +'&via=atsbyvermouth','','scrollbars=no,menubar=no,height=450,width=650,resizable=yes,toolbar=no,location=no,status=no'); 
}

DEMO.

查看更多
登录 后发表回答