0

Following is the jquery code I am using to add a script file to a link opened via document.open method but it is not adding to the url

$(document).ready(function(){
    $('button').on('click',function(){
        var myid = $(this).attr('id');
        var url = "http://mysite.com/"+ myid +"/index.html";
        window.open(url,"_blank","toolbar=yes, location=yes, directories=no, status=no, menubar=yes, scrollbars=yes, resizable=no, copyhistory=yes, width=400, height=400");

        var s = document.createElement("script");
        s.type = "text/javascript";
        s.src = "http://mysite.com/apiwrapper.js";
        $("head").append(s);
    })
})

I need to add http://mysite.com/apiwrapper.js to my url i.e. opened via window.open method

swapnesh
  • 26,318
  • 22
  • 94
  • 126
  • @Gautam3164 I tried this but not working :( actually I cannot add this in index.html page as it refers to the Users..so have to dynamically add this – swapnesh Aug 17 '13 at 11:51
  • 1
    You might want to have a look at this: http://stackoverflow.com/questions/10472927/add-content-to-a-new-open-window – Josh Aug 17 '13 at 11:52

0 Answers0