Paste script through CSS content property

Is it possible to insert a script tag using a CSS content property?

The example below inserts plain text instead of the html tag

#someDiv:before { content:"<script>$(function(){ console.log('test');});</script>"; } 
+4
source share
1 answer

Content inserted into the content property will only ever be plain text. This is necessary to prevent recursion. It also helps to prevent people from crazy things like inserting script elements with CSS.

+6
source

Source: https://habr.com/ru/post/1489694/


All Articles