Reputation: 63
I want to read the html content from given url, but it shows same origin error(I know about this error). So I have tried different method. Open a new window and open the website to that window and read the content from that window, but not work please help me.
Note: This is for my cordova application!
I tried like below
var myWindow=window.open('http://www.google.com','','width=200,height=100');
//myWindow.document.write("<p>This is 'myWindow'</p>");
alert(myWindow.innerHTML);
myWindow.document.close();
Upvotes: 0
Views: 25002
Reputation: 2173
$.get( "http://www.google.com/", function( data ) {
console.log(data);
});
With help of jQuery, you can get html content of specified URL. Replace your desired URL with "http://www.google.com/"
. It won't give error in real device or Emulator. But if you will check in Browser then it will give error of CORS.
Regards
Upvotes: 5