user3327101
user3327101

Reputation: 191

Document.write can be a form of eval

function x(y){document.write('<script src="'+y+'" type="text/javascript"></script>')

Document.write can be a form of eval.

Got this message from jshint any idea how can solve the problem?

Upvotes: 1

Views: 4268

Answers (1)

Niet the Dark Absol
Niet the Dark Absol

Reputation: 324750

Sure. Don't use document.write.

var s = document.createElement('script');
s.src = y;
document.body.appendChild(s);

Upvotes: 2

Related Questions