Railsers:

Suppose I have a page inside an IFrame, and it knows nothing about
Prototype.js.

Now suppose I set the IFrames' src to javascript:void(function(){ ... }) and
put a big string of raw Javascript where that ... is.

Now suppose that string wants to ping a server with new Ajax.Request.

The JS source to foist prototype.js into an unwilling page reputedly looks
like this:

  var newScript = document.createElement('script');
  newScript.type = "text/javascript";
  newScript.src = "/javascripts/prototype.js";
  document.getElementsByTagName('head')[0].appendChild(newScript);

      new Ajax.Request( '/ctrl/action', ...);

That looks beautiful (for various definitions of "beautiful"), however it
doesn't seem to affect the scope of the current JS.

My next experiment will foist first, with one src=javascript:void() line,
and will then evaluate the new Ajax.Request on a second
src=javascript:void() line.

I'm curious if there's a cleaner solution. (Note that project constraints
forbid me to simply <script src='...prototype.js'> in the target IFrame...)

-- 
  Phlip
  http://www.greencheese.us/ZeekLand <-- NOT a blog!!!


--~--~---------~--~----~------------~-------~--~----~
 You received this message because you are subscribed to the Google Groups 
"Ruby on Rails: Spinoffs" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-spinoffs?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to