Facebook integration javascript not working in ie8 or ie9

I'm using the javascript below to get my storyline file to post the user's score from the game I've made. Everything seems okay but in ie8 and ie9 the button that runs the javascript seems to do nothing. Any thoughts?

var player = GetPlayer();
var Title= "Check out my score!";
var points= player.GetVar("points");
var URL= "www.google.co.uk";
window.open('https://www.facebook.com/sharer/sharer.php?s=100&p%5Btitle%5D='+Title+'&p%5Burl%5D=http%3A%2F%2F'+URL+'&p%5Bsummary%5D='+points+'&p%5Bimages%5D%5B0%5D=http%3A%2F%2Fwww.urltoyourimage.com', "Post to Facebook", "status = 1, height = 300, width = 300, resizable = 0");
5 Replies
Ashley Terwilliger

Hi Conor, 

Cool idea and integration with Facebook - I'm not equipped to assist with Javascript elements, so hopefully someone in the community will be able to assist and offer some specific advice here, but in the meantime I did want to offer the general reminder about Storyline and Javascript best practices. 

Conor Bradley

Thanks for the advice Mike - I did some digging and in the end I found the solution to my problem on Stack Overflow 

http://stackoverflow.com/questions/1444677/window-open-not-working-in-ie8

Apparently the issue is that IE8/9 don't like it when there are spaces in the window name specified in window.open   Crazy I know. Anyway I just modified the 'Post to Facebook' name to 'PTF' and it seems to work ok now. Modified javascript below:

var player = GetPlayer();
var Title= "Check out my score!";
var points= player.GetVar("points");
var URL= "www.google.co.uk";
window.open('https://www.facebook.com/sharer/sharer.php?s=100&p%5Btitle%5D='+Title+'&p%5Burl%5D=http%3A%2F%2F'+URL+'&p%5Bsummary%5D='+points+'&p%5Bimages%5D%5B0%5D=http%3A%2F%2Fwww.urltoyourimage.com', "PTF", "status = 1, height = 300, width = 300, resizable = 0");