throws invalid argument in IE7-8-9b

I don't know enough about javascript to figure out why the line in this script that begins "" throw an invalid argument error in IE7-8-9b. Works fine in Firefox and Webkit.

(The script is envoked with an onclick="share.fb()"in a html link and pops up a new browser window to share at FB and Twitter).

var share = {
    fb:function(title,url) {
    tw:function(title,url) {
    share:function(tpl,title,url) {
    if(!url) url = encodeURIComponent(window.location);
    if(!title) title = encodeURIComponent(document.title);

    tpl = tpl.replace("##URL##",url);
    tpl = tpl.replace("##TITLE##",title);,"sharewindow"+tpl.substr(6,15),"width=640,height=480");


IE disallows spaces and other special characters in window name (the second argument). You need to remove them before passing as argument.




"sharewindow"+tpl.substr(6,15).replace(/\W*/g, '')

so that you end up with,"sharewindow"+tpl.substr(6,15).replace(/\W*/g, ''),"width=640,height=480");

(that's basically a regex replacement which says "replace every sequence of non-aplhabetic character by nothing")

Live demo here (configure if necessary your popup blocker)

Need Your Help

Ajax - How to use a returned array in a success function

javascript php jquery ajax arrays

Hi I have a php code that returns an array. I want to be able to use this array in my ajax success function but I'm not sure how to go about doing this. I have tried the following, but no luck.

In TFS, how do I do a baseless merge on specific changesets?

command-line tfs merge

As with most things in TFS you get more than you bargained for. In this case I am seeing more file changes during the merge than I was expecting.