0

I'm creating an extension for Chrome (Just noraml HTML/JS). I would like to make an advanced scripting mode for users.

In a form I'll put this:

function generateString(){
    //EDITABLE PART
    return val;
}

if somebody for example put window.location="", nothing should happen, or if somebody put myVar=55; (previously defined in my code), it shouldn't do anything either. The only thing that I want to access is the return value.

Is this possible somehow? Googled for it and found something about putting it into a iframe, but they could still do window.location="javascript:dosomehaxing()", right?

Thanks a lot!

Henrik Karlsson
  • 5,559
  • 4
  • 25
  • 42

1 Answers1

0

Since nobody posted an answer in the answer section, I'll post my findings here:

From the thread that serg commented with, the question "Is It Possible to Sandbox JavaScript Running In the Browser?", JSandbox seems to be the best, lightweight option to me. Its syntax is quite simple, too.

Community
  • 1
  • 1
Henrik Karlsson
  • 5,559
  • 4
  • 25
  • 42