Reading html from phantom (not from index.html by FS) #10

shumkov opened this Issue Jun 23, 2014 · 3 comments


None yet
2 participants

shumkov commented Jun 23, 2014

Now prerender has bad restriction - it must be placed on a same server with a JS project.
Why we can't get html from baseURL?


Stanback commented Jun 23, 2014

I'll revisit this - the reason I'm reading index.html from the FS is so that I can manipulate the HTML before sending it to Phantom or JSDOM. I have a plugin hook called beforeInit, which gets used by the removeScriptTags.js plugin to remove Google Analytics and custom fonts.


Stanback commented Jun 23, 2014

I've merged in pull request #11 for dealing with this issue.

I'm now using the 'request' library to fetch the index.html page from baseUrl + applicationPage and then I feed the HTML into Phantom or JSDOM. This allows us to preserve the plugin logic for pre-processing of the HTML, such as removing Google Analytics code, etc.

In the future, I may try experimenting with telling Phantom and JSDOM to fetch index.html directly - I can use onResourceRequested to have Phantom skip certain hosts/files, and JSDOM has something similar called SkipExternalResources.

Let me know if you have any issues and I'll re-open.

Stanback closed this Jun 23, 2014


shumkov commented Jun 24, 2014


Stanback removed the in progress label Jul 17, 2014

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment