Sharer link with parameter in URL
Asked Answered
P

1

7

I have a popup window with a Facebook custom share link.

http://www.facebook.com/sharer.php?u=<url to share>&t=<title of content>

How can I use a url u with a parameter like http://google.com/?q=bla? It looks like facebook always cut of the parameter.

Physicality answered 28/9, 2011 at 13:42 Comment(0)
P
6

You should URL encode the parameters.

var facebook_url = 'http://www.facebook.com/sharer.php?'+
  'u='+encodeURIComponent('http://google.com/?q=bla')+
  '&amp;t='+encodeURIComponent('Some Page Title');
Piddock answered 28/9, 2011 at 14:17 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.