Facebook Share Dialog IE8
by Riley MacDonald, August 12, 2013
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:
1 2 3 4 5 6 7 8 9 | <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> |
The name parameter ‘facebook-share-dialog’ must have the dashes removed:
1 2 3 4 5 6 7 8 9 | <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> |
Voila the share button now works in IE8.
User Comments:
Thanks for the help. I just spent 45 minutes for this...
awesome.. i spent almost 2 hours for this... thank you so much:)
Thanks for the help. I just spent 30 minutes thinking about how to resolve this.
Thank you very much for this explanation.
After two hours of search, I finally found the solution that worked perfectly.
[…] After search I found this solution is working for me: https://rileymacdonald.ca/2013/08/12/facebook-share-dialog-ie8/ […]