loading...

Simple way to diff server/browser rendering results

lucifer1004 profile image Gabriel Wu ・1 min read

I found this answer at StackOverflow. I think it is useful, so I share with you here.

Browser side

First of all, you should ensure the site is served. Then you can:

  • Open your site in any browser
  • Open the browser console, and type:
console.log(document.documentElement.innerHTML)
  • Copy the output, and save it as client.html

Server side

Supposing your site is running on localhost:3000.

  • Open a shell, and type:
curl localhost:3000 > server.html

Compare the differences

You can simply run:

diff client.html server.html

Note that you may need to format both files before diff.

Posted on by:

lucifer1004 profile

Gabriel Wu

@lucifer1004

A writer. Writing academic papers, blogs, codes, documents, essays, novels, poems, and translations.

Discussion

markdown guide