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?

 <script type="text/javascript">

			SqueezeBox.initialize({});

  </script>

Thanks in advance

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?

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.

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.

OK great.

Here is the page:

Thanks again

Hi,

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

window.addEvent('domready', function() {

into this:

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.

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 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>

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.

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

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.

Thanks again!

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

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

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

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 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:

		// 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.

Hi there,

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

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/joomla/tracker/?action=TrackerItemEdit&tracker_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:

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.

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

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:

// 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.

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.

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.