V
V
Vladimir Grabko2016-08-31 22:11:43
Programming
Vladimir Grabko, 2016-08-31 22:11:43

Is it possible to render an html/js page on the server?

I have a resulting html page with a bunch of java script. Is it possible to render it and get the original html (without js)?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
X
xmoonlight, 2016-08-31
@VGrabko

If only links and containers are needed (and the original links are static):
1. Get the DOM render of the page using phantom.js
2. Get the current DOM with all object properties after rendering
3. Remove all scripts from there (filter).
4. We extract all the styles of DOM objects from the DOM - we form a new style (CSS) for each of the DOM objects for this page, which we then minimize, inline (to the style tag in the header).
5. Save the finished page as an HTML file.

S
Sergey, 2016-08-31
@gangstarcj

It seems that if you press Ctrl + U, then the source code will open and js is not processed in it

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question