I am using the facebook like/share button
to share the current url/page.
So in the beginning my url is "example.com" afer a few seconds the url is modyfied and the new url is like "example.com/123".
The problem is that example.com is shared instead of example.com/123.
Is there a way to share the new url?
Simply updating the
data-href attribute on the button will do nothing – it has already been parsed, and “no one cares” any more about what attributes you might change afterwards.
You will have to remove the button from the document, replace it with a new one – and then call FB.XFBML.parse to get the new button parsed.