Link fallback when JavaScript is disabled Link fallback when JavaScript is disabled
 

News:

cpg1.5.48 Security release - upgrade mandatory!
The Coppermine development team is releasing a security update for Coppermine in order to counter a recently discovered vulnerability. It is important that all users who run version cpg1.5.46 or older update to this latest version as soon as possible.
[more]

Main Menu

Link fallback when JavaScript is disabled

Started by Unarmed, November 10, 2004, 10:09:47 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Unarmed

In several locations, new windows are created for larger versions of images.  For instance, in displayimage.php:188, the link that's created looks like so:
<a href="javascript:;" onClick="MM_openBrWindow('displayimage.php?pid=xxx&fullsize=1','(unique ID)','scrollbars=yes,toolbar=yes,status=yes,resizable=yes,width=xxx,height=yyy')">
If JavaScript is turned off, nothing happens.  It would seem preferable, then, to alter the link to look like this:
<a href="displayimage.php?pid=xxx&fullsize=1" onClick="MM_openBrWindow(this.href,'(unique ID)','scrollbars=yes,toolbar=yes,status=yes,resizable=yes,width=xxx,height=yyy');return false;">
The onclick event takes precedence over the actual link, opening the window when JavaScript is enabled.  When JS isn't on, the browser simply goes through to the enlarged picture -- graceful degradation.

A side benefit is that this way, in Mozilla Firefox, users can choose to open the link in a new tab without the new tab's location being "javascript:;".

There are quite a few instances of this pattern, but this one was brought to my attention in another forum.

Tarique Sani

Thanks - this should indeed be fixed. How about letting us know where all it occurs and we will fix it.
SANIsoft PHP applications for E Biz

Joachim Müller

should only be in the code once afaik.

Joachim

Unarmed

I was able to find these instances:
searchnew.php lines 151,154, and 170
versioncheck.php line 110

Incidentally, you could have MM_openBrWindow() return false in scripts.js, then have the onclick="return MM_openBrWindow(...);" to avoid the extra "return false;" I'd previously suggested.

Joachim Müller

both searchnew.php and versioncheck.php are visible for the admin only. You won't be able to administer your coppermine page if you disable JavaScript anyway, so there's little point in the suggestion. However, I'll apply the fix (won't hurt at least).

Joachim