S
S
Stack Overflow2020-08-30 16:44:48
css
Stack Overflow, 2020-08-30 16:44:48

How to correctly insert html code into the srcdoc attribute?

The question is that there is a minified html code with js and css inside, and it already has an iframe with srcdoc inside, it needs to be placed in the iframe, it turns out two nested srcsoc attributes. The problem is that a collision appears, " and ', if you replace everything inside" with ', then the internal srcdoc stops working, I tried to replace it with & quot ; it seems to start working, but it knocks out in the style attribute in the font names, for example, font-name: "Chepuxa", closes the style attribute in front of the font name, it's not realistic to figure it out manually, I want to replace it.

Answer the question

In order to leave comments, you need to log in

2 answer(s)
A
Andrey Fedorov, 2020-08-30
@aliencash

For nested quotes, try the characters ` and \' (the latter is used as a single character).
In addition, you can use font names without quotes in font-name, even if there is a space in the name.

S
Stack Overflow, 2020-09-03
@glebsky

In general, I found a service that screens html, and I managed to cope with this task.
https://www.freeformatter.com/html-escape.html

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question