rtp-atw / nimble-interview

Nimble Repository
https://nimble-interview.vercel.app
MIT License
0 stars 0 forks source link

[Feature] Render the stored HTML in the UI #22

Open olivierobert opened 8 months ago

olivierobert commented 8 months ago

Issue

While the Google search result content is stored in the database, users can only view the HTML as code. The page is not viewable.

Screenshot 2566-12-06 at 12 48 04

As a result, a user cannot verify if the scraping results are correct.

Expected

The HTML content should be viewable on the application, e.g., there could be a view of the content on a new page or in a modal.

[!Note] There is a bit of a challenge to render HTML content from another page. Hence it is an expected feature of the application 😺

olivierobert commented 8 months ago

There are some issues in the implementation as the rendered HTML is rendered in the same context as the application page, causing even JS to executed (see the GDPR-related popup):

image

A better standard alternative is to use an iframe. In this case, the srcdoc attribute can be used to inject the HTML content to the iframe: https://www.w3schools.com/tags/att_iframe_srcdoc.asp