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

News:

CPG Release 1.6.26
Correct PHP8.2 issues with user and language managers.
Additional fixes for PHP 8.2
Correct PHP8 error with SMF 2.0 bridge.
Correct IPTC supplimental category parsing.
Download and info HERE

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