net.CrossDomain = Class.Events.Extend({ initialize: function(domain, url) { var Self = this; this.domain = domain; this.url = (this.url) ? (this.domain +'/'+ this.url) : this.domain; this.iFrame = new Element('iframe', { src: this.url, styles: { width: '1px', height: '1px', position: 'absolute', left: '-10000px' } }).inject().onLoaded(function(){ Self.__onload(); }); }, __onload: function() { var iFrame = this.iFrame; var Self = this; // Establish Proxy Objects if (!window.opera) { // Sync with iFrame.window.net.* this.HTTPRequest = iFrame.contentWindow.HTTPRequest; this.WebService = iFrame.contentWindow.WebService; } else { // Sync with CrossDomain.Opera.* this.HTTPRequest = function(options){ return new net.CrossDomain.Opera.HTTPRequest(options, Self); }; this.WebService = function(options){ return new net.CrossDomain.Opera.WebService(options, Self); } } // Fire event this.fireEvent('load'); } }); net.CrossDomain.Opera = { HTTPRequest: JSCafe.Component.Extend({ create: function(options, domain) { this.domain = domain; net.CrossDomain.Opera.throwNotAvailable(); }, request: function() { } }), WebService: JSCafe.Component.Extend({ create: function(options, domain) { this.domain = domain; net.CrossDomain.Opera.throwNotAvailable(); }, send: function() { } }), throwNotAvailable: function() { throw new Error("Opera is not supported for net.CrossDomain.* yet... Support is coming!") } };