Results 1 to 6 of 6

Thread: Problem with IE6 and ScriptTagProxy

  1. #1

    Cool Problem with IE6 and ScriptTagProxy

    I'm sure you're all groaning at seeing ScriptTagProxy float by again

    Using Ext 2.2 and in IE6 only ScriptTagProxy throws an error after the callback has completed, as it's destroying the Script Tag about an invalid argument in destroyTrans;

    destroyTrans:function(B,A){this.head.removeChild(document.getElementById(B.scriptId));

    The Ext app runs in an iframe, I thought that might be causing issues for IE6, but, this.head.appendChild() seems to work just fine to create the script in the first place.

    IE7, FF2, FF3, Safari, Chrome all work fine.

    Any clues as to how to work around this one?

    I've toyed with having the code returned from the remote call wrap the callback call in a
    try/catch, but, that somehow seems dirty (well dirtier than I'd like at least ).

    Thanks,
    --TJ

  2. #2

  3. #3

    Default

    Which FAQ entry in particular were you referring to since specifically IE6 + ScriptTagProxy wasn't in there.

    Since the code works with all other browsers including IE7 and doesn't error inside the code and the callback (my code) runs to completion, it's not a hanging comma.

    I've already determined it's a problem with deleting the <script> tag that was created by ScriptTagProxy, the code runs correctly if I try/catch the tag delete code.

    I can't see anything referencing that in any of the FAQs.

  4. #4
    Sencha User
    Join Date
    Jul 2010
    Posts
    34

    Default

    I used this override:

    Code:
    Ext.override(Ext.data.ScriptTagProxy, {
        destroyTrans : function(trans, isLoaded){
        try
        {
            this.head.removeChild(document.getElementById(trans.scriptId));
        }
        catch(e)
        {
            //IE6 does not like removeChild() to be called directly from the parent element
            document.getElementById(trans.scriptId).parentNode.removeChild(document.getElementById(trans.scriptId))
        }
        clearTimeout(trans.timeoutId);
        if(isLoaded){
            window[trans.cb] = undefined;
            try{
                delete window[trans.cb];
            }catch(e){}
        }else{
            // if hasn't been loaded, wait for load to remove it to prevent script error
            window[trans.cb] = function(){
                window[trans.cb] = undefined;
                try{
                    delete window[trans.cb];
                }catch(e){}
            };
        }
    }
        });
    Techakone, The Technological African
    http://www.aboukone.com

  5. #5
    Sencha User Condor's Avatar
    Join Date
    Mar 2007
    Location
    The Netherlands
    Posts
    24,245

    Default

    And that works? But the parentNode of the <script> tag should be the <head> element...

  6. #6
    Sencha User
    Join Date
    Jul 2010
    Posts
    34

    Default

    Yes it works. It seems that the problem is with the IE6 engine itself. The <script> tag is effectively a child of the <head> element but accessing it through the removeChild() method chokes the browser in IE6. Access through the parentNode property works fine.
    Techakone, The Technological African
    http://www.aboukone.com

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •