Plan B: Remote Scripting With IFRAMEs

I have plans to apply AJAX to our library catalog but I’m running into a problem where I can’t do XMLHttpRequest events to servers other than the one I loaded the main webpage from. Mozilla calls it the “same origin policy,” everyone else calls it a cross-domain script exclusion, or something like that.

Some Mozilla folks are working on a standard to address the problem, but it could be quite a while before browser support is common enough to build for it.

So Plan A was to use simple AJAX with XMLHTTPRequest. Plan B comes from this crazy suggestion at Apple’s developer site: Remote Scripting with IFRAME. It looks like different functions are subject to different restrictions, so the theory is that a JavaSctript loaded in a page in a hidden IFRAME can call functions from the parent page and do pretty much everything we’ve come to expect of XMLHTTPRequest. Here’s an example they offer.

Crazy as it is it works, and it gets around some cross-domain script exclusions for some browsers, but it still gets trapped by Mozilla.

tags: , , , , , , , , , , , , , ,

5 Comments

  1. Pingback by wendelmaques / Ajax sem ActiveX on May 16, 2006 10:46 pm

    [...] [2] Plan B: Remote Scripting With IFRAMEs [...]

  2. Trackback by Living Better BLOG on June 16, 2006 5:45 am

    Single pure javascript to extract information from a webpage at different domain is impossible!…

    I tried to load some webpages via an iframe. I can load a arbitrary webpage into an iframe, but I can’t access any information from this iframe for security issues. Cross-domain information exchange seems to be impossible, if I don’t have s…

  3. Pingback by rascunho » Blog Archive » links for 2007-04-24 on April 24, 2007 4:21 pm

    [...] » Plan B: Remote Scripting With IFRAMEs So Plan A was to use simple AJAX with XMLHTTPRequest. Plan B comes from this crazy suggestion at Apple’s developer site: Remote Scripting with IFRAME. It looks like different functions are subject to different restrictions, so the theory is that a JavaS (tags: maisonbisson.com 2007 cross_domain ajax) [...]

  4. Comment by pytchfork on August 1, 2007 3:13 pm

    Any success in this arena? We’re implementing a proxy for our own work, but wish to offer JavaScript libraries for others to access our utilities.

  5. Comment by songboom on August 30, 2007 3:38 am

    I am also in a similar predicament - and I don’t know a good solution either…

Comments RSS TrackBack Identifier URI

Leave a comment

 

User contributed tags for this post:

cross domain iframe (393) - iframe cross domain (366) - xmlhttprequest cross domain (206) - javascript cross domain scripting (185) - ajax cross domain (184) - iframe domain (157) - iframe cross domain script (119) - xmlhttprequest cross site (119) - cross domain scripting iframe (104) - cross domain ajax (102) - iFrame cross site (102) - cross domain xmlhttprequest (83) - iframe cross domain scripting (77) - cross domain ajax iframe (76) - enable cross site scripting (75) - cross domain javascript (69) - allow cross site scripting (63) - jquery iframe (61) - ajax cross domain iframe (61) - remote scripting iframe (60) - crossdomain javascript (58) - Cross domain iframes (57) - ajax Iframe (55) - Cross Domain Javascript iframe (54) - firefox cross domain scripting (53) - cross site iframe (53) - firefox enable cross site scripting (52) - javascript cross domain (51) - javascript cross domain iframe (50) - iframe xss (47) - enable cross domain scripting (47) - cross domain iframe scripting (46) - iframe crossdomain (46) - XMLHttpRequest subdomain iframe (46) - cross domain scripting (44) - javascript iframe cross domain (43) - allow cross domain scripting (43) - cross domain scripting javascript (39) - javascript iframe (39) - iframes cross domain (37) - REMOTE SCRIPTING WITH IFRAME (37) - remote scripting firefox (35) - javascript crossdomain (35) - scripting iframes (34) - IFrame remote scripting (34) - cross domain iframe javascript (34) - firefox allow cross site scripting (31) - XMLHTTPRequest crossdomain (30) - iframe remote (29) - ajax iframe cross domain (28) - remote script iframe (27) - iframe cross scripting (26) - iframe ajax cross domain (26) - javascript iframe domain (26) - javascript iframe firefox (26) - enable cross site scripting firefox (26) - cross site ajax iframe (26) - ajax cross site scripting (25) - firefox enable cross domain scripting (25) - iframe google maps crossite (24) - iframe cross site scripting (24) - XMLHttpRequest bookmarklet (23) - ajax cross site (23) - cross site scripting xmlhttprequest (23) - cross domain remote scripting (22) - ajax crossdomain (22) - cross site xmlhttprequest (21) - cross domain IFrame ajax (21) - javascript iframe cross site (19) - XMLHttpRequest cross site scripting (19) - cross domain scripting firefox (19) - iframe cross domain javascript (18) - xmlhttprequest cross (18) - iframe javascript cross domain (18) - iframe cross domain ajax (18) - crossdomain scripting (18) - jquery iframe parent (18) - remote scripting cross domain (17) - iframes cross site (17) - remote iframe (17) - iframe sandbox (17) - xmlhttprequest firefox (16) - cross domain ajax google maps (16) - remote scripting iframes (16) - enable iframes in firefox (16) - crossdomain iframe (15) - google maps cross domain (15) - enable cross domain scripting firefox (15) - Firefox remote scripting (15) - javascript iframes firefox (15) - cross site javascript iframe (15) - cross domain hack (15) - jquery iframe cross domain (15) - xss iframe (15) - cross-domain IFRAME (15) - javascript iframe scripting (14) - IFRAME cross domain xmlhttprequest (14) - javascript iframe remote (14) - how to allow cross site scripting (14) - iframe JavaScript restrictions (14) - iframe remote script (13) - iframe javascript (13) - Firefox iframe javascript (13) - how to enable cross site scripting (13) - allowing cross site scripting (13) - scripting iframe (12) - ajax cross (12) - iframes (12) - cross domain ajax mozilla (12) - cross domain firefox (12) - iframe firefox (12) - javascript iframe Remote Scripting (12) - cross site scripting enable (12) - firefox enable cross domain (12) - jquery cross domain iframe (12) - remote (11) - scripting firefox (11) - iframe javascript domain (11) - firefox iframe cross domain (11) - enable cross site scripting in firefox (11) - iframe cross domain security (11) - enable cross domain firefox (11) - cross site scripting allow (11) - F (11) - remote scripting (10) - remote scripting iframe javascript (10) - google xmlhttprequest cross domain (10) - ajax same origin (10) - AJAX iframes (10) - cross domain javascript frame (10) - firefox cross site scripting enable (10) - firefox enable remote scripting (10) - firefox cross frame scripting (10) - xmlhttprequest different domain (10) - cross iframe scripting (9) - iframes remote scripting (9) - hidden iframe remote scripting (9) - xmlhttprequest remote domain (9) - AJAX IFrames cross domain (9) - javascript iframe remote script (9) - firefox cross domain (9) - iframe same origin (9) - remote scripting hidden iframe (9) - cross site scripting and AJAX (9) - iframe crossdomain javascript (9) - firefox disable cross site scripting (9) - enabling cross site scripting (9) - iframe cross-domain (9) - ajax cross domain mozilla (8) - firefox cross domain javascript (8) -