Click here to Skip to main content
13,549,129 members
Click here to Skip to main content
Add your own
alternative version


8 bookmarked
Posted 15 May 2011
Licenced CPOL

Javascript Injection at it's Finest!, without even using Eval()!

, 15 May 2011
Rate this:
Please Sign up or sign in to vote.
JS Injection
String.prototype.code = function(){ return (new Function('with(this) { return ' + this + '}' )).call({}); };
var s = 'alert("hello!");'


This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


About the Author

Software Developer (Senior) Codevendor
United States United States
Please visit my personal website for my latest codes and updates.

You may also be interested in...


Comments and Discussions

GeneralVery interesting solution! Pin
DrABELL15-May-11 16:17
memberDrABELL15-May-11 16:17 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.

Permalink | Advertise | Privacy | Terms of Use | Mobile
Web01-2016 | 2.8.180515.1 | Last Updated 15 May 2011
Article Copyright 2011 by M@dHatter
Everything else Copyright © CodeProject, 1999-2018
Layout: fixed | fluid