4

Making a site that has a videos that are inside Iframe opened with Highslide. It all works great except in IE. When I close the Highslide (and delete the Iframe inside), I get these error messages :

SCRIPT5007: Unable to get property 'random' of undefined or null reference
File: jquery.min.js, Line: 2, Column: 1711

SCRIPT5009: 'jQuery' is undefined
File: flowplayer.min.js, Line: 6, Column: 1

SCRIPT5009: 'flowplayer' is undefined
File: index.php, Line: 20, Column: 4

Occasionally I get a repeating error of:

SCRIPT445: Object doesn't support this action
File: jquery.min.js, Line: 2, Column: 4058

If I reopen the exact same Highslide Iframe right after the error occurs, it'll open just fine without any problems, but still have errors on close. I'm honestly stumped on what to do to fix this.

Chaosxmk
  • 774
  • 14
  • 28
  • 1
    What you mean with "closing iframe"? You can create/remove them, you can show/hide them, you can change the src of them, but definitely not open or close them. Also IE11 and jQuery < 1.11.0 is a non-working combination. – Teemu Jun 13 '14 at 18:44
  • Sorry, a bit vague about that I guess. I meant that when I close the Highslide popup, its set to delete it's contents effectively "closing" the iframe in question. Also, I just checked and I am running jquery 1.11.1. – Chaosxmk Jun 13 '14 at 19:12
  • Please give us a link to your page. Why do people do this? Why post a question without providing a live example? Don't TELL us - SHOW us! – MisterNeutron Jun 13 '14 at 21:46
  • The problem is in your scripts, not in highslide. See errors no error in this library. – Sebastian Bochan Jun 16 '14 at 09:02

2 Answers2

2

It sounds like what you've encountered is a weird corner bug with IE. Basically, if an iframe is in another element, in certain cases, when that element is destroyed, the scripts in the iframe will run again, this time with no context - things like Object and Math will just be gone.

Because these are scripts running on a destroyed iframe, I've found the errors to generally be harmless, but I still don't like having them.

I found that something about the interaction between IE and jQuery (1.11.0) seems to cause this. Try emptying out the element containing the iframe using pure DOM calls first:

                // Instead of:
                //$('div').empty();

                // Run this:
                var div = $('div')[0];
                while (div.firstChild) {
                    div.removeChild(div.firstChild);
                }

No idea why this works, or even if it works in most cases (it worked in my sandbox but not in actual code), and no interest in further diagnosing IE's weird maladies, but it does seem to sometimes eliminate the error and essentially work the same way. :)

Chris
  • 5,876
  • 3
  • 43
  • 69
0

In the highslide-full.js file (version 4.1.12), in the afterClose function (somewhere around line 2926) you should find this:

if (this.outline && this.outlineWhileAnimating) this.outline.destroy();

Immediately after that line, add this:

if (this.iframe) {
  this.body.removeChild(this.iframe);
}

We've solved our IE9 closing issue with that extra code.

Glen Little
  • 6,951
  • 4
  • 46
  • 68