How to render perfect copy of the DOM tree
up vote
0
down vote
favorite
I have tried with Chrome and Puppter following:
- Wait long enough for all images to be loaded (as I had my browser opened it was easy step)
- Make a copy of the DOM tree with document.cloneNode(true)
- Filter out javascript (as I want static view only)
- Finally return copy with XMLSerializer with serializeToString as a string an save as .html file.
The browser viewport was set the same size as the one from which the copy was made. However rendered page isn't acceptable some images are visible below others, rendered view is not the same.
Any idea why this is happening? I thought I had a perfect DOM copy.
javascript google-chrome browser google-chrome-devtools puppeteer
add a comment |
up vote
0
down vote
favorite
I have tried with Chrome and Puppter following:
- Wait long enough for all images to be loaded (as I had my browser opened it was easy step)
- Make a copy of the DOM tree with document.cloneNode(true)
- Filter out javascript (as I want static view only)
- Finally return copy with XMLSerializer with serializeToString as a string an save as .html file.
The browser viewport was set the same size as the one from which the copy was made. However rendered page isn't acceptable some images are visible below others, rendered view is not the same.
Any idea why this is happening? I thought I had a perfect DOM copy.
javascript google-chrome browser google-chrome-devtools puppeteer
1
Sounds like you didn't embed CSS into the file, in which case they may fail to load if the remote server has CORS restriction (also causes the failure with the images). Either 1) save to MHTML or 2) manually embed all CSS and images e.g. via data URI.
– wOxxOm
2 days ago
add a comment |
up vote
0
down vote
favorite
up vote
0
down vote
favorite
I have tried with Chrome and Puppter following:
- Wait long enough for all images to be loaded (as I had my browser opened it was easy step)
- Make a copy of the DOM tree with document.cloneNode(true)
- Filter out javascript (as I want static view only)
- Finally return copy with XMLSerializer with serializeToString as a string an save as .html file.
The browser viewport was set the same size as the one from which the copy was made. However rendered page isn't acceptable some images are visible below others, rendered view is not the same.
Any idea why this is happening? I thought I had a perfect DOM copy.
javascript google-chrome browser google-chrome-devtools puppeteer
I have tried with Chrome and Puppter following:
- Wait long enough for all images to be loaded (as I had my browser opened it was easy step)
- Make a copy of the DOM tree with document.cloneNode(true)
- Filter out javascript (as I want static view only)
- Finally return copy with XMLSerializer with serializeToString as a string an save as .html file.
The browser viewport was set the same size as the one from which the copy was made. However rendered page isn't acceptable some images are visible below others, rendered view is not the same.
Any idea why this is happening? I thought I had a perfect DOM copy.
javascript google-chrome browser google-chrome-devtools puppeteer
javascript google-chrome browser google-chrome-devtools puppeteer
asked 2 days ago
user3918502
1
1
1
Sounds like you didn't embed CSS into the file, in which case they may fail to load if the remote server has CORS restriction (also causes the failure with the images). Either 1) save to MHTML or 2) manually embed all CSS and images e.g. via data URI.
– wOxxOm
2 days ago
add a comment |
1
Sounds like you didn't embed CSS into the file, in which case they may fail to load if the remote server has CORS restriction (also causes the failure with the images). Either 1) save to MHTML or 2) manually embed all CSS and images e.g. via data URI.
– wOxxOm
2 days ago
1
1
Sounds like you didn't embed CSS into the file, in which case they may fail to load if the remote server has CORS restriction (also causes the failure with the images). Either 1) save to MHTML or 2) manually embed all CSS and images e.g. via data URI.
– wOxxOm
2 days ago
Sounds like you didn't embed CSS into the file, in which case they may fail to load if the remote server has CORS restriction (also causes the failure with the images). Either 1) save to MHTML or 2) manually embed all CSS and images e.g. via data URI.
– wOxxOm
2 days ago
add a comment |
active
oldest
votes
active
oldest
votes
active
oldest
votes
active
oldest
votes
active
oldest
votes
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53372943%2fhow-to-render-perfect-copy-of-the-dom-tree%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
1
Sounds like you didn't embed CSS into the file, in which case they may fail to load if the remote server has CORS restriction (also causes the failure with the images). Either 1) save to MHTML or 2) manually embed all CSS and images e.g. via data URI.
– wOxxOm
2 days ago