I'm not even sure if this is possible, but is there anyway to set an execution context beyond setting the value for "this"?
The case I am primarily referring to is executing code from one frame in the context of another frame, so that when I access global objects (ex: window, document...) from a function that was defined in frame1, It will be executed in the frame2 environment.
If this is not possible, what are some workarounds? Please don't say "just define the function in the child frame", I'm dealing with a larger application framework, and it would be both pointless and memory inefficient if I had to load up two instances of the entire framework.
EDIT: Here is some code which should demonstrate what I am trying to do. When run, it should show an alert that, if a solution is found, displays "iframe.html" at the end of the location string.
<script>
function run() {
go.call(window.iframe);
}
function go() {
alert(window.location);
}
</script>
<iframe src="iframe.html" name="iframe" onload="run()">
Thanks.