working properly in ie but its not working in another browser eg- Chrome, firefox

working properly in ie but its not working in another browser eg- Chrome, firefox


This is myjs.js file

var publicCounter = 1;

(function () {

    var xmlhttp = null;

    if (typeof XMLHttpRequest != 'udefined') {

        xmlhttp = new XMLHttpRequest();

    } else if (typeof ActiveXObject != 'undefined') {

        xmlhttp = new ActiveXObject('Microsoft.XMLHTTP');

    } else {

        throw new Error('You browser doesn\'t support ajax');

    }

    xmlhttp.open('GET', 'http://localhost:12798/myproject/TargetPage.aspx');

    xmlhttp.onreadystatechange = function () {

        if (xmlhttp.readyState == 4) {

            Updatedata(xmlhttp);

        }

    };

    xmlhttp.send(null);


    function Updatedata(xhr) {

        var lines = xhr.responseText;

        var scripts = document.getElementsByTagName('script');

        var script = scripts[publicCounter];

        publicCounter = publicCounter + 1;

        var div = document.createElement('div');

        div.innerHTML = lines;

        script.parentNode.insertBefore(div, script);

    }

I am calling this file from another project

http://localhost:8756/Test/Default.aspx

 <form id="form1" runat="server"> 

<script src='http://localhost:12798/myproject/myjs.js' type='text/javascript'></script> 

</form> 


This code is working properly in ie but its not working in another browser eg- Chrome, firefox

Please help...