0

This is my code in javascript to parse a document but I want it to parse the document on the given url and not the one I'm coding on.

I am using location.href to redirect it to the desired url but its not working and the current url displayed is of my web from (the one I'm working on)

<script  type="text/javascript" >
    function wordcount () {
       //location.href='http://www.w3schools.com';
        window.location.href = "http://www.google.com";
        alert(window.location.toString().toLowerCase());
        var words = document.getElementsByTagName('body')[0].innerHTML.replace(/<.*?>/g,'');
        alert( words.match(/\S+/g));
        //alert("hi");
    }
</script>
Steph Locke
  • 5,951
  • 4
  • 39
  • 77
aneena
  • 187
  • 1
  • 2
  • 13

0 Answers0