1. #1
    Sencha User
    Join Date
    Mar 2007
    Posts
    580
    Vote Rating
    0
    dolittle is an unknown quantity at this point

      0  

    Default xdomainrequest support

    xdomainrequest support


    Is there a support for xdomainrequest using IE?
    This feature is old in IE8 but I can't find info about it in extjs.

    Thanks

  2. #2
    Sencha User
    Join Date
    May 2010
    Posts
    14
    Vote Rating
    0
    neofraktal is on a distinguished road

      0  

    Default


    I'm also interested on xdomainrequest

  3. #3
    Sencha User charris's Avatar
    Join Date
    Sep 2010
    Location
    Brooklyn, NY
    Posts
    106
    Vote Rating
    13
    charris will become famous soon enough

      0  

    Default


    +1 on the request to add support for Internet Explorer's (stupid, non-standard as usual) XDomainRequest object so that ExtJS can offer cross-origin/domain request (COR) support for all modern browsers.

    http://en.wikipedia.org/wiki/Cross-O...source_Sharing
    http://msdn.microsoft.com/en-us/libr...(v=vs.85).aspx

  4. #4
    Sencha - Services Team arthurakay's Avatar
    Join Date
    Sep 2008
    Location
    Antioch, IL
    Posts
    1,353
    Vote Rating
    33
    arthurakay is a jewel in the rough arthurakay is a jewel in the rough arthurakay is a jewel in the rough

      0  

    Default


    Quote Originally Posted by charris View Post
    ...so that ExtJS can offer cross-origin/domain request
    Isn't that exactly what JSONP does?

    Furthermore, where would you like Sencha to add this capability? Ext.Ajax? That won't happen as (to my knowledge) other browsers don't support cross-domain AJAX calls (only JSONP) so the result would be an inconsistent implementation within the Sencha frameworks.
    Arthur Kay
    Developer Relations Manager, Sencha Inc.

    Twitter | Sencha Chicago User Group

  5. #5
    Sencha User charris's Avatar
    Join Date
    Sep 2010
    Location
    Brooklyn, NY
    Posts
    106
    Vote Rating
    13
    charris will become famous soon enough

      0  

    Default


    Hey Arthur, thanks for chiming in. Btw, I was planning to take you up on your tweet last week about Sencha devs meeting up at a bar in NYC, but something came up... Anyways, in regards to this feature request:

    JSONP certainly works in several cases, but as you know, some browsers like MSIE don't allow GET URLs longer than ~2K characters; this puts a limit on the amount of data you can send back to the server that wouldn't be an issue with POST.

    The XMLHttpRequest object in current versions of Chrome/FF/Safari (and I think iOS 5 + Android Browser 3) support cross-domain POSTing as long as the server uses the appropriate headers. There's a nice article about CORS here, and some more info here. MSIE 8/9 does not; you have to use their silly XDomainRequest object instead of XMLHttpRequest.

    You might argue that CORS is the future, not JSONP. It doesn't require any "tricks" like dynamically inserting script elements into the DOM, using an iframe etc. More importantly, there's a W3C spec for it: http://www.w3.org/TR/cors/. The server just needs to support the CORS HTTP headers (instead of wrapping responses in a JSONP callback).

    So with the prospect of a spec/standard way of doing cross-domain GET+POST requests, and most browsers supporting it in some form already, it seems like Sencha should consider supporting it (which really only means using XDomainRequest on MSIE).

    Thoughts? I'd be really curious to hear what Team Sencha thinks since you guys are really the pros when it comes to this stuff.

  6. #6
    Sencha - Services Team arthurakay's Avatar
    Join Date
    Sep 2008
    Location
    Antioch, IL
    Posts
    1,353
    Vote Rating
    33
    arthurakay is a jewel in the rough arthurakay is a jewel in the rough arthurakay is a jewel in the rough

      0  

    Default


    Quote Originally Posted by charris View Post
    I was planning to take you up on your tweet last week about Sencha devs meeting up at a bar in NYC, but something came up...
    No worries... no one took me up on the offer, but there's always a next-time.

    I would agree that older IE browsers present a problem regarding URL size limits, so JSONP obviously doesn't make the best choice. I normally suggest for that you create a server-side "router" class which takes your request (from the same domain) and does the cross-domain calls on the server. This alleviates any concern over IE's URL limits, and would also allow for a variety of return types (XML, JSON, etc).

    I actually didn't know about the cross-domain AJAX requests being implemented by newer browsers. Thanks for sharing those links... you learn something new every day!

    Keeping CORS in mind, I suppose that it does make sense to add this to the framework at some point. The problem still remains for older browsers - and it's not an easy problem to solve given that Sencha's mission is to have the same code work across ALL browsers.

    I'm not on the engineering team, but I would bet this issue is somewhere on their radar. I'll see if I can poke one of them for a comment.
    Arthur Kay
    Developer Relations Manager, Sencha Inc.

    Twitter | Sencha Chicago User Group

  7. #7
    Sencha User charris's Avatar
    Join Date
    Sep 2010
    Location
    Brooklyn, NY
    Posts
    106
    Vote Rating
    13
    charris will become famous soon enough

      0  

    Default


    The "work on every browser" concern is definitely a valid point. And using a server-side "router" is a great idea. (Also a server-side reverse proxy would do the trick.)

    Quote Originally Posted by arthurakay View Post
    I'll see if I can poke one of them for a comment.
    Thanks--I'd love to hear their thoughts, but I'm sure everyone is extremely busy prepping for Austin and working on 4.1, so no worries if nobody gets back to you.

  8. #8
    Sencha Premium Member skirtle's Avatar
    Join Date
    Oct 2010
    Location
    UK
    Posts
    3,590
    Vote Rating
    322
    skirtle has a brilliant future skirtle has a brilliant future skirtle has a brilliant future skirtle has a brilliant future skirtle has a brilliant future skirtle has a brilliant future skirtle has a brilliant future skirtle has a brilliant future skirtle has a brilliant future skirtle has a brilliant future skirtle has a brilliant future

      0  

    Default


    The "work on every browser" concern is definitely a valid point.
    It wouldn't be unprecedented though. The LocalStorage proxy doesn't work in all browsers.

  9. #9
    Sencha User charris's Avatar
    Join Date
    Sep 2010
    Location
    Brooklyn, NY
    Posts
    106
    Vote Rating
    13
    charris will become famous soon enough

      0  

    Default


    Wow, just noticed that Ext.data.Connection API docs now mention a "cors" config param:

    cors: Boolean. True to enable CORS support on the XHR object. Currently the only effect of this option is to use the XDomainRequest object instead of XMLHttpRequest if the browser is IE8 or above.

    Not sure when this was added, but it's definitely not in the docs that came with the 4.0.6 download. Awesome!

  10. #10
    Sencha User
    Join Date
    Nov 2011
    Location
    Toronto
    Posts
    105
    Vote Rating
    2
    basememara is on a distinguished road

      0  

    Default Ext.Loader and CORS compatibility?

    Ext.Loader and CORS compatibility?


    I have a different way of using CORS. Instead of using CORS to get cross-domain JSON data, I need it for embedding my application on other websites. This means I need Ext.Loader to be CORS compatible so it can dynamically load my script files when enabled (for requiring classes, MVC setup, plugins, etc).

    Here is my scenario for using CORS: my application resides on a remote server with its own domain. In the Ext.application section, I have the appFolder property pointed to its own domain (so remote sites know where to access it when they embed my app). In the Apache server where my app resides, I have also enabled "cross-origin resource sharing":

    Code:
    Header set Access-Control-Allow-Origin *
    Now websites and bloggers can paste the embed code for my Sencha app without copying any files. This means they will be referencing my app.js file from my remote web server (one Sencha app serving multiple websites).

    This scenario works PERFECTLY when browsing various blogs and websites via Chrome or Firefox. BUT when viewing the sites with the latest IE, nothing loads and I get the following error:

    SCRIPT575: Could not complete the operation due to error c00c023f.
    ext-all-debug-w-comments.js, line 7805 character 17
    Code:
            /**
             * Load a script file, supports both asynchronous and synchronous approaches
             *
             * @param {String} url
             * @param {Function} onLoad
             * @param {Object} scope
             * @param {Boolean} synchronous
             * @private
             */
            loadScriptFile: function(url, onLoad, onError, scope, synchronous) {
                var me = this,
                    noCacheUrl = url + (this.getConfig('disableCaching') ? ('?' + this.getConfig('disableCachingParam') + '=' + Ext.Date.now()) : ''),
                    fileName = url.split('/').pop(),
                    isCrossOriginRestricted = false,
                    xhr, status, onScriptError;
    
    
                scope = scope || this;
    
    
                this.isLoading = true;
    
    
                if (!synchronous) {
                    onScriptError = function() {
                        onError.call(scope, "Failed loading '" + url + "', please verify that the file exists", synchronous);
                    };
    
    
                    if (!Ext.isReady && Ext.onDocumentReady) {
                        Ext.onDocumentReady(function() {
                            me.injectScriptElement(noCacheUrl, onLoad, onScriptError, scope);
                        });
                    }
                    else {
                        this.injectScriptElement(noCacheUrl, onLoad, onScriptError, scope);
                    }
                }
                else {
                    if (typeof XMLHttpRequest !== 'undefined') {
                        xhr = new XMLHttpRequest();
                    } else {
                        xhr = new ActiveXObject('Microsoft.XMLHTTP');
                    }
    
    
                    try {
                        xhr.open('GET', noCacheUrl, false);
                        xhr.send(null);
                    } catch (e) {
                        isCrossOriginRestricted = true;
                    }
    
    
                    status = (xhr.status === 1223) ? 204 : xhr.status;  <<----ERROR HAPPENS HERE (LINE: 7805)
    
    
                    if (!isCrossOriginRestricted) {
                        isCrossOriginRestricted = (status === 0);
                    }
    
    
                    if (isCrossOriginRestricted
                    ) {
                        onError.call(this, "Failed loading synchronously via XHR: '" + url + "'; It's likely that the file is either " +
                                           "being loaded from a different domain or from the local file system whereby cross origin " +
                                           "requests are not allowed due to security reasons. Use asynchronous loading with " +
                                           "Ext.require instead.", synchronous);
                    }
                    else if (status >= 200 && status < 300
                    ) {
                        // Firebug friendly, file names are still shown even though they're eval'ed code
                        new Function(xhr.responseText + "\n//@ sourceURL=" + fileName)();
    
    
                        onLoad.call(scope);
                    }
                    else {
                        onError.call(this, "Failed loading synchronously via XHR: '" + url + "'; please " +
                                           "verify that the file exists. " +
                                           "XHR status code: " + status, synchronous);
                    }
    
    
                    // Prevent potential IE memory leak
                    xhr = null;
                }
            },
    I am not sure if it helps, but maybe these links can shed light and solve the Ext.Loader / IE / CORS issue?

Similar Threads

  1. Ext 4.0 (offline support, local database support)
    By tfrugia in forum Community Discussion
    Replies: 1
    Last Post: 27 Apr 2010, 8:05 AM

Thread Participants: 7