Advanced search  

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]

Pages: [1]   Go Down

Author Topic: Link fallback when JavaScript is disabled  (Read 3965 times)

0 Members and 1 Guest are viewing this topic.

Unarmed

  • Coppermine newbie
  • Offline Offline
  • Posts: 2
Link fallback when JavaScript is disabled
« on: November 10, 2004, 10:09:47 pm »

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:
Code: [Select]
<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:
Code: [Select]
<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.
Logged

Tarique Sani

  • VIP
  • Coppermine addict
  • ***
  • Offline Offline
  • Gender: Male
  • Posts: 2712
    • http://tariquesani.net
Re: Link fallback when JavaScript is disabled
« Reply #1 on: November 11, 2004, 05:46:02 am »

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

Joachim Müller

  • Dev Team member
  • Coppermine addict
  • ****
  • Offline Offline
  • Gender: Male
  • Posts: 47843
  • aka "GauGau"
    • gaugau.de
Re: Link fallback when JavaScript is disabled
« Reply #2 on: November 11, 2004, 07:10:53 am »

should only be in the code once afaik.

Joachim
Logged

Unarmed

  • Coppermine newbie
  • Offline Offline
  • Posts: 2
Re: Link fallback when JavaScript is disabled
« Reply #3 on: November 11, 2004, 09:38:32 pm »

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.
Logged

Joachim Müller

  • Dev Team member
  • Coppermine addict
  • ****
  • Offline Offline
  • Gender: Male
  • Posts: 47843
  • aka "GauGau"
    • gaugau.de
Re: Link fallback when JavaScript is disabled
« Reply #4 on: November 12, 2004, 08:53:49 am »

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
Logged
Pages: [1]   Go Up
 

Page created in 0.023 seconds with 20 queries.