javascript - How to add stringified script tag in express + jade/pug -


i have express using pug view. index.pug has following:

script(type='text/javascript').       window.__data__ = !{payload} 

where payload json object. has been stringified in render function of express:

res.render('index', {     payload : json.stringify({        "anexample": "<script></script>"     }) }) 

when json object has </script> terminates window.__data = function due ending script tag. how can prevent blowing page? limitation of pug or express or browser?

you're going have "break up" string containing script tags.

something should work:

"anexample": "<script></scr" + "ipt>" 

this way, </scr" + "ipt> won't interpreted closing script tag.


Comments

Popular posts from this blog

php - How to add and update images or image url in Volusion using Volusion API -

javascript - jQuery UI Splitter/Resizable for unlimited amount of columns -

javascript - IE9 error '$'is not defined -