How to Add Facebook Share Dialog On Your Page

Add a share button to share your page with your facebook friends is very easy by using facebook API.

Here is the link: Share Dialog

Just one issue is after I added the code on my site, the javascript is not working when I uses IE8 and IE9. The error is “invalid argument”.

After search I found this solution is working for me:  http://rileymacdonald.ca/2013/08/12/facebook-share-dialog-ie8/

Using the Facebook Share Dialog provided by the Facebook Developer Page, I discovered it was not working in IE8. The error console provided an ‘invalid argument’ error. After some debugging I discovered it was the ‘name’ parameter of the window.open() call. IE8 fails to run the script if any dashes are used in the name parameter. Other browsers do not seem to have a problem with this.

The provided FB share code:

The name parameter ‘facebook-share-dialog’ must have the dashes removed:

Voila the share button now works in IE8.

 

 

Leave a Reply