forum.coppermine-gallery.net

Support => cpg1.4.x Support => Older/other versions => cpg1.4 miscellaneous => Topic started by: PCG on June 16, 2008, 06:43:42 pm

Title: [Solved]: javascript error when viewing image with firefox
Post by: PCG on June 16, 2008, 06:43:42 pm
I get a java script error after clicking on an image to see a larger size. The error only seems to appear with firefox on windows and os x.

Example from os x:
Error: Warning: unrecognized command line flag -psn_0_2490369
Source File: file:///Applications/Firefox.app/Contents/MacOS/components/nsBrowserContentHandler.js
Line: 706

The error is independent from the theme, there are no mods/plugins installed, it happens with every image.

Link: http://www.ibanezcollectors.com/gallery/displayimage.php?album=8&pos=3  (click the image)

Any help would be greatly appreciated.

PCG
Title: Re: javascript error when viewing image with firefox
Post by: Sami on June 16, 2008, 10:02:14 pm
I don't see that error , tried with FF on windows
Probably it's a bug on FF on mac
Not related to Coppermine IMO
Title: Re: javascript error when viewing image with firefox
Post by: steveeh131047 on June 16, 2008, 10:15:48 pm
Sami,

I'm running FF2 under windows. When I click the Intermediate image I get the full size image in a new window, but I also get a FF "Error Console" window pop up. The Error console window is empty!

Steve
Title: Re: javascript error when viewing image with firefox
Post by: Nibbler on June 16, 2008, 10:21:06 pm
From memory, that's caused by using

Code: [Select]
<a href="javascript:"
instead of

Code: [Select]
<a href="javascript:;"
I don't know if that's related to the mac issue.
Title: Re: javascript error when viewing image with firefox
Post by: PCG on June 16, 2008, 10:24:00 pm
I got it with FF2 on the PC also.   

Searching returned this thread: http://forums.mozillazine.org/viewtopic.php?t=532094

It seems that, "In Firefox, when "javascript:" is entered as an address, it opens the error console." 


Is there a way to modify the '<a href="javascript:"' reference to a standard URL in Coppermine?

Code: [Select]
<a href="javascript:" onclick="return MM_openBrWindow('picEditor.php?id=51','Crop_Picture','scrollbars=yes,toolbar=no,status=yes,resizable=yes')" ...
Title: Re: javascript error when viewing image with firefox
Post by: Nibbler on June 16, 2008, 10:24:51 pm
Check theme_html_picture() in your custom theme.
Title: Re: javascript error when viewing image with firefox
Post by: PCG on June 16, 2008, 10:29:25 pm
It seems to happen in all of the themes, including the "classic" theme.

Check theme_html_picture() in your custom theme.

What would I be looking for and where would I find this call?
Title: Re: javascript error when viewing image with firefox
Post by: Nibbler on June 16, 2008, 10:41:40 pm
If it happens in all themes then you must have edited include/themes.inc.php. Upload a clean copy.
Title: Re: javascript error when viewing image with firefox
Post by: PCG on June 16, 2008, 10:58:12 pm
If it happens in all themes then you must have edited include/themes.inc.php. Upload a clean copy.

Did not modify the file to my knowledge, but grabbed a fresh download and uploaded include/themes.inc.php. 

No joy. I still get the error console.  Any other ideas?

Title: Re: javascript error when viewing image with firefox
Post by: PCG on June 16, 2008, 11:05:25 pm
Looking through "include/themes.inc.php". I found:

Code: [Select]
$pic_html = "<a href=\"javascript:;\" onclick=\"MM_openBrWindow('displayimage.php?pid=$pid&amp;fullsize=1','" . uniqid(rand()) . "','scrollbars=yes,toolbar=no,status=no,resizable=yes,width=$winsizeX,height=$winsizeY')\">";

Yet the rendered code is:
Code: [Select]
<a href="javascript:" onclick="MM_openBrWindow('displayimage.php?pid=47&amp;fullsize=1','8972373614856d477e8ed8','scrollbars=yes,toolbar=no,status=no,resizable=yes,width=1370,height=2051')"><img src="albums/userpics/11027/normal_Ibanez_Artist_AR300_sn_I815227.JPG" class="image" alt="Click to view full size image" border="0"><br></a>

Is it odd to be missing the ";"?
Title: Re: javascript error when viewing image with firefox
Post by: Nibbler on June 16, 2008, 11:10:03 pm
OK, I found the previous thread (http://forum.coppermine-gallery.net/index.php/topic,48072.0.html) and I think the same solution used there will work for you.
Title: Re: javascript error when viewing image with firefox
Post by: PCG on June 17, 2008, 04:36:53 pm
The code change worked. Adding "void(0)" keeps the console window from opening.

Code: [Select]
$pic_html = "<a href=\"javascript:;\" ...

to

Code: [Select]
$pic_html = "<a href=\"javascript:void(0);\" ...

Thanks Nibbler.
Title: Re: [Solved]: javascript error when viewing image with firefox
Post by: Joachim Müller on June 21, 2008, 04:25:28 pm
@Nibbler: potential bug?
Title: Re: [Solved]: javascript error when viewing image with firefox
Post by: Nibbler on June 21, 2008, 04:34:23 pm
No, but we should avoid using javascript links like that anyway.