Can you visit non-localhost websites through the browser?
lopugit opened this issue · 5 comments
Just wondering
I'm not a contributor but I've been testing lately and it seems to work for non-localhost sites.
it's just that it seems like the site is downloaded and used offline so some client-side javascript stuff can't really be used?
I wish I knew more about how it works and I for sure wish I had the time to do some thorough testing right now, to be honest.
Also, it would be a lot easier to give you information if you could tell us what you've tried and what isn't working.
As far as Zombie and how it works vs a browser, I could be wrong but from my understanding, it should be able to execute 3rd party JS because, and anyone correct me if I'm wrong, the way it works is like this:
- you visit a URL
- browser downloads the
index.html
file, for example - browser executes JS script(s) that were embedded or downloaded via the
index.html
file - some scripts make HTTP(S) requests back to the 3rd party's back end API.
- browser updates the parts of the HTML page that the JS updated, using the response(s) from the 3rd party's API.
So in the case of your code using Zombie, it should just mimic what the browser is doing with the page. When you pass it a non-localhost URL it should send an HTTP request to the site which will send back a file which your browser will render and run.
I have no idea how it'll do with AJAX and I haven't tested any of that.
My testing has been more POC-style, where I'm evaluating a concept and thinking about using Zombie. If I get there I'll update but for now, I can say that I think it'll work for you but you should tell us a bit more about your errors or something.
I'm still evaluating this concept I'm working on so I don't need to be concerned with how well Zombie is working quite yet.
One thing I can tell you is that I'm using Zombie now because I tried Cheerio and there were way more pages coming back as un-rendered JS than when I use Zombie against the same set of URLs, so that probably means Zombie is executing at least some of the JS because Cheerio doesn't.
In principle client side java script can be used. Zombie is a "headless browser", simulating a real one.
There will be some limitations compared with google chrome, but after the first steps it is a powerfull tool