python - Requesting HTML page with JavaScript (Angular app) -


python has module called httplib allows retrieval of html resource url. code:

httpserv = httplib.httpconnection("www.google.com") httpserv.connect() httpserv.request('get',"/search?q=python") ... httpserv.close()  

i trying same thing in angular app, using $http doesn't allow me retrieve html document due same origin policy.

is there similar python method available in javascript?

so, same-origin policy has nothing javascript. says "don't allow scripts on page talk scripts being run host."

this extremely important security feature. means if put jquery on page, , somehow jquery cdn got hacked , changed jquery send passwords page, wouldn't work (so long browser enforces same-origin policy).

you don't have problem when working python because python exclusively runs on server (from web-app perspective). server can talk machine wants to, browsers not (and should not seen above) give freedom webpages.

so, how solve problem? make request script running on server. have server curl or wget or w/e of google.com, have server send data client.


Comments

Popular posts from this blog

java - pagination of xlsx file to XSSFworkbook using apache POI -

Unlimited choices in BASH case statement -

apache - How do I stop my index.php being run twice for every user -