<p>I have just received and bypassed a problem with LightWindow and IE7 where, on page load, it throws a JavaScript error on line 444 of <code>lightwindow.js</code>, claiming that the <code>object does not support this property or method</code>. Despite finding various postings on various forums, no Google result I could find had a solution, so I am posting this here in the hopes that it will help someone / myself later.</p>

<p>Many suggested a specific order of the script files but I was already using this order (prototype, scriptaculous, lightwindow).</p>

<p>These are the steps I took that seemed to finally work, I write them here only as a record as I do not know nor have time to test which ones specifically "fixed" the issue:</p>

<ol>
<li>Moved the call to lightwindow.js to the bottom of the page.</li>
<li>Changed line 444 to: <code>if (this._getGalleryInfo(link.rel)) {</code></li>
<li>Changed line 1157 to: <code>if (this._getGalleryInfo(this.element.rel)) {</code></li>
<li>Finally, I enclosed (and this is dirty, my apologies) lines 1417 to 1474 with a <code>try/catch</code> block, swallowing the exception.</li>
</ol>

<p><strong>EDIT:</strong> </p>

<p>I realised that this broke Firefox. Adding the following as line 445 now makes it work - <code>try { gallery = this._getGalleryInfo(link.rel); } catch (e) { }</code></p>

<p>It's not a very nice fix, but my page (which contains a lightwindow link with no "rel" tag, several lightwindow links which do have "rel" tags, and one "inline" link) works just fine in IE7 now.  Please comment if you have anything to add about this issue or problems with / improvements to my given solution.</p>

[{'answer_id': 47224, 'author': 'John Boker', 'author_id': 2847, 'author_profile': 'https://Stackoverflow.com/users/2847', 'pm_score': 1, 'selected': False, 'text': "<p>Instead of the try..catch maybe you could try using </p>\n\n<pre><code>if( this &amp;&amp; this._getGalleryInfo )\n{\n    //use the function\n\n}\n</code></pre>\n\n<p>you could also check in the same way <strong>this.element.rel</strong> ( <code>if(this &amp;&amp; this.element &amp;&amp; this.element.rel)</code> ... ) before using it.</p>\n\n<p>It looks like there's a case that the <code>_getGalleryInfo</code> or <code>this.element.rel</code> has not yet been initialized so it wouldn't exist yet. Check if it exists then if I does use it.</p>\n\n<p>of course i could  be completely wrong, the only way to know is by testing it out.</p>\n"}, {'answer_id': 595214, 'author': 'Community', 'author_id': -1, 'author_profile': 'https://Stackoverflow.com/users/-1', 'pm_score': 0, 'selected': False, 'text': '<p>I had the same problem with Lightwindow 2.0, IE6, IE7, IE8 (beta); I resolved in the following way for IE6, IE7, IE8 (beta).</p>\n\n<p>Instead of:<br/>\n&nbsp;<code>if(gallery = this._getGalleryInfo(link.rel))</code><br/>\nI put on lines 443 and 1157:<br/>\n&nbsp;<code>gallery = this._getGalleryInfo(link.rel)</code><br/>\n&nbsp;<code>if(gallery)</code><br/></p>\n\n<p>Hope this will help!</p>\n'}, {'answer_id': 627554, 'author': 'Community', 'author_id': -1, 'author_profile': 'https://Stackoverflow.com/users/-1', 'pm_score': 1, 'selected': True, 'text': "<p>I fixed this by changing line 444 to:</p>\n\n<pre><code>var gallery = this._getGalleryInfo(link.rel)\n</code></pre>\n\n<p>Then changing the subsequent comparison statement to: </p>\n\n<pre><code>if(gallery.length &gt; 0)\n{\n    // Rest of code here...\n</code></pre>\n\n<p>...which seems to have sorted it in IE6+ and kept it working in Firefox etc.</p>\n\n<p>I didn't change line 1157 at all, but I haven't read the code to see what I actually does so I can't comment on its relevance? </p>\n\n<p>I suspect the ? used in the example rel attribute (Evoution?[man]) may be causing the problem with IE but without spending some time testing a few things, I can't be sure?</p>\n\n<p>HTH.  </p>\n"}]
['https://Stackoverflow.com/questions/41928', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/192/']