0

I had to work on my showroom url. When you click on a project, a pop-up is shown with this url :

example.org/en/showroom/#projName

So I changed the url with js blablabla and when I inspect my page, I have what I want for the sharing button. For fb example : http://www.facebook.com/sharer/sharer.php?u=http%3A//example.org/en/showroom/#jaguar

But when I click on the button, the fb pop-up opening has this url : example.org/en/showroom/

This is so weird. Is it not just a string ? Does the '#' messing with it ?

Jay Cee
  • 1,855
  • 5
  • 28
  • 48

1 Answers1

0

Check out the built-in function escape(), encodeURIComponent(str) and encodeURI(str).

You have three options:

escape() will not encode: @*/+

encodeURI() will not encode: ~!@#$&*()=:/,;?+'

encodeURIComponent() will not encode: ~!*()'

The character encoding used with escape is variable. So I would stick with encodeURI and encodeURIComponent, which use UTF-8.

Sifference between encodeURI() and encodeURIComponent()

Community
  • 1
  • 1
Darren Willows
  • 2,053
  • 14
  • 21