Saturday, 28 September 2013

why is "href" attribute needed in "a" tag in FB share code

why is "href" attribute needed in "a" tag in FB share code

<a href="#"
onclick="
window.open(
'https://www.facebook.com/sharer/sharer.php?u='+encodeURIComponent(location.href),
'facebook-share-dialog',
'width=626,height=436');
return false;">
Share on Facebook
</a>
Apologies if this is a beginner question. But why is "href" there? What
purpose does it serve? I am not getting its purpose.
I am assuming "onclick" a new window will be opened which has all the
information in it about the link to be shared and the FB target
destination.
Then why is "href" there????

No comments:

Post a Comment