简体   繁体   中英

How to set custom url for facebook like button

I have added Facebook like button on my web app. Here the code on my html

 <div class="fb-like" data-href=http://someSite.com/ data-width="350" data-show-faces="false" data-send="false"></div>

I looked through stackoverflow and found that i can catch curent url for html by this code

string path = HttpContext.Current.Request.Url.AbsoluteUri;

And now I want to set this like button for my path value. Smth like this

<div class="fb-like" data-href=path data-width="350" data-show-faces="false" data-send="false"></div>

But it doesn't work. I looked through stackover but didn't find any answers )

Try this

string path = HttpContext.Current.Request.Url.AbsoluteUri;

<div class="fb-like" data-href=""+path +"" data-width="350" data-show-faces="false" data-send="false"></div>

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