I’m trying to append javascript to a loaded page by:
var sc = document.createElement('script');
sc.content = "<script>alert('aa')</script>";
document.body.appendChild (sc);
But that didn’t work in chromium:

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
You don’t put
<script>...</script>inside the content of ascriptelement. But more to the point, I don’t think they have acontentproperty (I don’t see one here, for instance).If I recall correctly, the most reliable way to put content within a
scriptelement at runtime is viacreateTextNodeandappendChild, e.g.: Live example | source…but I wouldn’t be surprised to find that some older browsers required you to set
innerTextor something instead.