DEV Community

Gabriel Wu
Gabriel Wu

Posted on

2 1

Simple way to diff server/browser rendering results

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)
Enter fullscreen mode Exit fullscreen mode
  • 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
Enter fullscreen mode Exit fullscreen mode

Compare the differences

You can simply run:

diff client.html server.html
Enter fullscreen mode Exit fullscreen mode

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

SurveyJS custom survey software

Build Your Own Forms without Manual Coding

SurveyJS UI libraries let you build a JSON-based form management system that integrates with any backend, giving you full control over your data with no user limits. Includes support for custom question types, skip logic, an integrated CSS editor, PDF export, real-time analytics, and more.

Learn more

Top comments (0)

Heroku

Build apps, not infrastructure.

Dealing with servers, hardware, and infrastructure can take up your valuable time. Discover the benefits of Heroku, the PaaS of choice for developers since 2007.

Visit Site

👋 Kindness is contagious

Please leave a ❤️ or a friendly comment on this post if you found it helpful!

Okay