SitePoint Sponsor

User Tag List

Page 1 of 2 12 LastLast
Results 1 to 25 of 26

Thread: IE 7 operation aborted error - javascript problem

  1. #1
    SitePoint Addict
    Join Date
    Jun 2006
    Posts
    240
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    IE 7 operation aborted error - javascript problem

    Hi Folks,

    This block of code is causing the above error on my Joomla site.

    Can anyone please tell me how I can rewrite this or fix the problem?

    Code:
     <script type="text/javascript">
    
    			SqueezeBox.initialize({});
    
      </script>
    Thanks in advance

  2. #2
    Grüße aus'm Pott
    SitePoint Award Recipient Pullo's Avatar
    Join Date
    Jun 2007
    Location
    Germany
    Posts
    2,422
    Mentioned
    39 Post(s)
    Tagged
    1 Thread(s)
    Quote Originally Posted by mattastic View Post
    Hi Folks,
    This block of code is causing the above error on my Joomla site.
    Can anyone please tell me how I can rewrite this or fix the problem?
    Hi,

    I found something relating to this on the Joomla Forums.
    Here's the link: http://forum.joomla.org/viewtopic.php?f=471&t=300470

    Does this help at all?
    How well do you know your JavaScript from your jQuery?
    Check out SitePoint's latest JavaScript challenge


    My blog

  3. #3
    SitePoint Addict
    Join Date
    Jun 2006
    Posts
    240
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Thanks very much for the reply.

    The thread is a few years old and the file that need changing looks quite a bit different.

    Any ideas?

    Thanks again.

  4. #4
    Grüße aus'm Pott
    SitePoint Award Recipient Pullo's Avatar
    Join Date
    Jun 2007
    Location
    Germany
    Posts
    2,422
    Mentioned
    39 Post(s)
    Tagged
    1 Thread(s)
    Hi,

    How long is the file in question?
    Would it be possible to post it somewhere (Pastebin, for example)?

    Although the thread in the forum is a few years old, I think it would still be worth having a look at this file.
    How well do you know your JavaScript from your jQuery?
    Check out SitePoint's latest JavaScript challenge


    My blog

  5. #5
    SitePoint Addict
    Join Date
    Jun 2006
    Posts
    240
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    OK great.

    Here is the page:

    http://pastebin.com/nUrmYD3z

    Thanks again

  6. #6
    Grüße aus'm Pott
    SitePoint Award Recipient Pullo's Avatar
    Join Date
    Jun 2007
    Location
    Germany
    Posts
    2,422
    Mentioned
    39 Post(s)
    Tagged
    1 Thread(s)
    Hi,

    Line 349 is the one you need to change.
    Try changing this:

    Code JavaScript:
    window.addEvent('domready', function() {
    into this:

    Code JavaScript:
    window.addEvent('load', function() {
    Not sure if it'll work, but this is what they were on about in the forum discussion I posted a link to.
    Let me know how it goes.
    How well do you know your JavaScript from your jQuery?
    Check out SitePoint's latest JavaScript challenge


    My blog

  7. #7
    SitePoint Addict
    Join Date
    Jun 2006
    Posts
    240
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Thanks very much for the reply. I;ve made that change, and the function has changed in the webpage. Problem is, I cant see any javascript library referenced in the head of the document. Is that right?

    Thanks again


    HTML Code:
    <html class="firefox firefox16" xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-gb" dir="ltr" lang="en-gb">
    <head>
    <base href="xxx/">
    <meta http-equiv="content-type" content="text/html; charset=utf-8">
    <meta name="keywords" content="joomla, Joomla">
    <meta name="description" content="Joomla! - the dynamic portal engine and content management system">
    <meta name="generator" content="Joomla! - Open Source Content Management">
    <title>Home - xxx</title>
    <link rel="stylesheet" type="text/css" href="/plugins/system/jch_optimize/cache/jscss.php?f=97f10f3853728535494f0bfa8c2702dd-cache-plg_jch_optimize-2f27a3976b7ea1654e79274298daa592&amp;type=css&amp;gz=gz&amp;d=2">
    <link href="/?format=feed&amp;type=rss" rel="alternate" type="application/rss+xml" title="RSS 2.0">
    <link href="/?format=feed&amp;type=atom" rel="alternate" type="application/atom+xml" title="Atom 1.0">
    <link href="/favicon.ico" rel="shortcut icon" type="image/vnd.microsoft.icon">
    <link href="/component/search/?format=opensearch" rel="search" title="Search xxx" type="application/opensearchdescription+xml">
    <script src="https://ssl.google-analytics.com/ga.js" async="" type="text/javascript"></script>
    <script type="text/javascript">
    window.addEvent('load',function(){new JCaption('img.caption');});</script>
    </head>
    <body>
    <div class="custom cookie">
      <p>We use cookies to improve your experience of using this website. <a href="/cookies">Find out more.</a></p>
    </div>
    <link rel="stylesheet" href="/templates/bccg_2/css/font-awesome.css">
    <!--[if IE 6]><link rel="stylesheet" href="/templates/bccg_2/css/template.ie6.css" type="text/css" media="screen" /><![endif]-->
    <!--[if IE 7]><link rel="stylesheet" href="/templates/bccg_2/css/template.ie7.css" type="text/css" media="screen" /><![endif]-->
    <!--[if IE 7]><link rel="stylesheet" href="/templates/bccg_2/css/font-awesome-ie7" type="text/css" media="screen" /><![endif]-->
    <script type="text/javascript">
    if('undefined'!=typeof jQuery)document._artxJQueryBackup=jQuery;</script>
    <script type="text/javascript">
    jQuery.noConflict();</script>
    <script type="text/javascript" src="/plugins/system/jch_optimize/cache/jscss.php?f=97f10f3853728535494f0bfa8c2702dd-cache-plg_jch_optimize-6896560e59a7a716cf1caea0710e3b45&amp;type=js&amp;gz=gz&amp;d=2"></script>
    <script type="text/javascript">
    if(document._artxJQueryBackup)jQuery=document._artxJQueryBackup;</script>

  8. #8
    Grüße aus'm Pott
    SitePoint Award Recipient Pullo's Avatar
    Join Date
    Jun 2007
    Location
    Germany
    Posts
    2,422
    Mentioned
    39 Post(s)
    Tagged
    1 Thread(s)
    I'm afraid I'm not sure.
    If everything still works as expected, then it's probably all good.
    If something seems to be broken or has stopped working, then we'll have to look for another solution.
    How well do you know your JavaScript from your jQuery?
    Check out SitePoint's latest JavaScript challenge


    My blog

  9. #9
    SitePoint Addict
    Join Date
    Jun 2006
    Posts
    240
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Thanks again, really appreciate it. IE 7 still gives operation aborted and shuts down.

    I still get the errors:

    Timestamp: 30/11/2012 12:47:14
    Error: TypeError: window.addEvent is not a function
    Source File: https://www.xxx/
    Line: 2

    Timestamp: 30/11/2012 12:55:26
    Error: ReferenceError: jQuery is not defined
    Source File: https://www.xxx/
    Line: 4

  10. #10
    Grüße aus'm Pott
    SitePoint Award Recipient Pullo's Avatar
    Join Date
    Jun 2007
    Location
    Germany
    Posts
    2,422
    Mentioned
    39 Post(s)
    Tagged
    1 Thread(s)
    Hmm, tricky one!
    Is it possible for you to post a link to the page, where I can have a look at what is going wrong and get an idea of the bigger picture.
    How well do you know your JavaScript from your jQuery?
    Check out SitePoint's latest JavaScript challenge


    My blog

  11. #11
    SitePoint Addict
    Join Date
    Jun 2006
    Posts
    240
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Thanks again!

    OK great, Is there a way I can post a link without search engines picking it up?

  12. #12
    Grüße aus'm Pott
    SitePoint Award Recipient Pullo's Avatar
    Join Date
    Jun 2007
    Location
    Germany
    Posts
    2,422
    Mentioned
    39 Post(s)
    Tagged
    1 Thread(s)
    You could PM me.
    Or when composing your message click "Go Advanced" and remove the tick by "Automatically parse urls" (don't know how effective that is).
    Or, you could get creative, e.g.:

    domain = mydomain
    tld = .com
    remote folder = testing

    Go to: www.domain.tld/remote folder/index.php
    How well do you know your JavaScript from your jQuery?
    Check out SitePoint's latest JavaScript challenge


    My blog

  13. #13
    Grüße aus'm Pott
    SitePoint Award Recipient Pullo's Avatar
    Join Date
    Jun 2007
    Location
    Germany
    Posts
    2,422
    Mentioned
    39 Post(s)
    Tagged
    1 Thread(s)
    Hi,
    So I've had a look at the site.
    Did you revert the changes we made to 'behavior.php'?
    It would be good if you could do this then summarize the problem in IE7
    How well do you know your JavaScript from your jQuery?
    Check out SitePoint's latest JavaScript challenge


    My blog

  14. #14
    SitePoint Guru
    Join Date
    Sep 2006
    Posts
    703
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by mattastic View Post
    Hi Folks,

    This block of code is causing the above error on my Joomla site.

    Can anyone please tell me how I can rewrite this or fix the problem?

    Code:
     <script type="text/javascript">
    
    			SqueezeBox.initialize({});
    
      </script>
    As I recall, the usual cause of that problem was when a script block positioned within a child element of <body>, attempted to generate an element. If that block is so positioned, try moving it out of the child element.
    Tab-indentation is a crime against humanity.

  15. #15
    SitePoint Addict
    Join Date
    Jun 2006
    Posts
    240
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Thanks for the replies and advice once again.

    Pullo

    Hi,
    So I've had a look at the site.
    Did you revert the changes we made to 'behavior.php'?
    It would be good if you could do this then summarize the problem in IE7
    Changed behaviour.php to this:

    PHP Code:
            // Attach modal behavior to document
            
    $document
                
    ->addScriptDeclaration(
                
    "
            window.addEvent('load', function() {

                SqueezeBox.initialize(" 
    $options ");
                SqueezeBox.assign($$('" 
    $selector "'), {
                    parse: 'rel'
                });
            });"
            
    ); 
    Still get the errors below in FF, IE 7 just closes with the operation aborted error.

    Timestamp: 02/12/2012 11:55:40
    Error: TypeError: window.addEvent is not a function
    Source File: https://www.xxx/
    Line: 2

    Timestamp: 02/12/2012 11:55:40
    Error: ReferenceError: jQuery is not defined
    Source File: https://www.xxx/
    Line: 4

    As I recall, the usual cause of that problem was when a script block positioned within a child element of <body>, attempted to generate an element. If that block is so positioned, try moving it out of the child element.
    Thanks for the reply, do you know how I can edit the code to do that? which page do I need to edit?

    Thanks again, really appreciate it.

  16. #16
    Grüße aus'm Pott
    SitePoint Award Recipient Pullo's Avatar
    Join Date
    Jun 2007
    Location
    Germany
    Posts
    2,422
    Mentioned
    39 Post(s)
    Tagged
    1 Thread(s)
    Hi there,

    The first errror is being caused by this line of code:

    Code JavaScript:
    window.addEvent('load',function(){new JCaption('img.caption');});

    This is a small block of MooTools code which Joomla adds to the head of every page to initialise JCaption image captions.
    This is actually a bug for which there is a patch submitted: http://joomlacode.org/gf/project/joo..._item_id=28511

    The easiest thing to do would be to remove this code. You can do this by adding the following code to the template index.php file, before the html output:

    Code PHP:
    if (isset($this->_script['text/javascript'])){
      $this->_script['text/javascript'] = preg_replace('%window\.addEvent\(\'load\',\s*function\(\)\s*{\s*new\s*JCaption\(\'img.caption\'\);\s*}\);\s*%', '', $this->_script['text/javascript']);
      if (empty($this->_script['text/javascript']))
        unset($this->_script['text/javascript']);
    }

    This should fix the first issue.

    Please let me know when you have done that.
    How well do you know your JavaScript from your jQuery?
    Check out SitePoint's latest JavaScript challenge


    My blog

  17. #17
    SitePoint Addict
    Join Date
    Jun 2006
    Posts
    240
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Hi Pullo

    Thanks again!

    Do you mean index.php in the root?

    http://pastebin.com/Yk0sUJBZ

    I'm not sure whereabouts that code needs to go

  18. #18
    Grüße aus'm Pott
    SitePoint Award Recipient Pullo's Avatar
    Join Date
    Jun 2007
    Location
    Germany
    Posts
    2,422
    Mentioned
    39 Post(s)
    Tagged
    1 Thread(s)
    Hi,

    I think index.php in the root is correct, but I'm not a Joomla user, so I'm working this out as I go.
    Nonetheless, let's give it a try.

    Insert the code I gave you into this file at line 52, just before the HTML output, like this:

    Code PHP:
    // NEW CODE BEGIN//
    if (isset($this->_script['text/javascript'])){
      $this->_script['text/javascript'] = preg_replace('%window\.addEvent\(\'load\',\s*function\(\)\s*{\s*new\s*JCaption\(\'img.caption\'\);\s*}\);\s*%', '', $this->_script['text/javascript']);
      if (empty($this->_script['text/javascript']))
        unset($this->_script['text/javascript']);
    }
    // NEW CODE END//
     
    // Return the response.
    echo $app;

    Please let me know when you have done that.
    How well do you know your JavaScript from your jQuery?
    Check out SitePoint's latest JavaScript challenge


    My blog

  19. #19
    SitePoint Addict
    Join Date
    Jun 2006
    Posts
    240
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    HI Pullo,

    Thanks again

    I get the error, when I make that change:

    500 - Internal server error.
    There is a problem with the resource you are looking for, and it cannot be displayed.

    http://pastebin.com/qmvt6i8y

  20. #20
    Grüße aus'm Pott
    SitePoint Award Recipient Pullo's Avatar
    Join Date
    Jun 2007
    Location
    Germany
    Posts
    2,422
    Mentioned
    39 Post(s)
    Tagged
    1 Thread(s)
    Oh dear!

    Which version of Joomla! are you using?

    Also, you seem to have a plugin installed called "jch_optimize"
    Could you disable that (temporarily)?
    It seems to be minifying the majority of your JS into one huge chunk and that is making the debugging process more difficult.
    How well do you know your JavaScript from your jQuery?
    Check out SitePoint's latest JavaScript challenge


    My blog

  21. #21
    SitePoint Addict
    Join Date
    Jun 2006
    Posts
    240
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    PHP Built On Windows NT CP5-14537 6.1 build 7600 (Windows Server 2008 R2 Standard Edition) i586
    Thanks again!

    I've looked in components and can't an extension of that name

    Version info below

    Database Version 5.5.24

    Database Collation utf8_general_ci
    PHP Version 5.3.13
    Web Server Microsoft-IIS/7.5
    WebServer to PHP Interface cgi-fcgi
    Joomla! Version Joomla! 2.5.6 Stable [ Ember ] 19-June-2012 14:00 GMT
    Joomla! Platform Version Joomla Platform 11.4.0 Stable [ Brian Kernighan ] 03-Jan-2012 00:00 GMT

  22. #22
    Grüße aus'm Pott
    SitePoint Award Recipient Pullo's Avatar
    Join Date
    Jun 2007
    Location
    Germany
    Posts
    2,422
    Mentioned
    39 Post(s)
    Tagged
    1 Thread(s)
    Hi,
    What plugins do you have installed, then?
    It would be a whole lot easier to debug this if we could disable the minification.
    How well do you know your JavaScript from your jQuery?
    Check out SitePoint's latest JavaScript challenge


    My blog

  23. #23
    SitePoint Addict
    Join Date
    Jun 2006
    Posts
    240
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Hi Pullo,

    I have found the plugin and disabled it :-)

  24. #24
    SitePoint Addict
    Join Date
    Jun 2006
    Posts
    240
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Tested it in IE 7.0.5, and it seems to work now!

    Disabling the plugin must of fixed it :-)

  25. #25
    Grüße aus'm Pott
    SitePoint Award Recipient Pullo's Avatar
    Join Date
    Jun 2007
    Location
    Germany
    Posts
    2,422
    Mentioned
    39 Post(s)
    Tagged
    1 Thread(s)
    Hi there mattastic,

    Yup, I can confirm that the error has disappeared from FireFox, Chrome, Opera (all latest), as well as IE 7 - IE10.

    If you look at the source code of the page (e.g. with Ctrl + U in Chrome or Firefox), you can see that all of the scripts are being included in the correct order.
    Whatever that plugin was doing, it was lumping the JavaScript together like that which was causing the error.

    That's not to say that minifying or caching your site's pages is a bad idea, quite the contrary.
    There seem to be a number of other plugins that offer this service. Maybea different one works better for you:

    https://www.google.co.uk/search?q=caching+plugin+joomla
    https://www.google.co.uk/search?q=minify+joomla

    Anyway, all's well that ends well.
    Can we consider this particular problem solved?
    How well do you know your JavaScript from your jQuery?
    Check out SitePoint's latest JavaScript challenge


    My blog

Bookmarks

Posting Permissions

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