Page 1 of 1
Making a surrogate
Posted: Sat Dec 14, 2013 11:28 am
by access2godzilla
Say, I want to make a surrogate script which replaces scripts from a certain website.
If my surrogate is like:
Code: Select all
function foo () {
/* do something */
}
Does foo() have a global scope? Can other code on the page call foo()?
Also, is it possible to make surrogates of entire frameworks (jquery, mootols etc.) in this manner?
Re: Making a surrogate
Posted: Sat Dec 14, 2013 3:56 pm
by barbaz
access2godzilla wrote:Can other code on the page call foo()?
A quick test with a local server indicates that yes, this is possible. Which makes me think that it should be possible to make surrogates for entire frameworks, but I haven't tried...
Re: Making a surrogate
Posted: Mon Dec 16, 2013 5:14 am
by Thrawn
I suppose in theory you could get a copy of a specific version of eg JQuery, review it to ensure it's safe, and put it in as a surrogate whenever a site wants JQuery. I'm not sure what that would do performance-wise, though. I guess, if you
use a file: URL, it could actually be faster.
Re: Making a surrogate
Posted: Mon Dec 16, 2013 3:42 pm
by barbaz
@Thrawn, that feature
doesn't work...