Package home | Report new bug | New search | Development Roadmap Status: Open | Feedback | All | Closed Since Version 2.5.1

Request #6005 During POST request, use href="javascript:void(0);" instead of href="#"
Submitted: 2005-11-17 23:30 UTC
From: remi at metacore dot net Assigned: quipo
Status: Closed Package: Pager
PHP Version: 5.0.5 OS: Linux
Roadmaps: (Not assigned)    
Subscription  


 [2005-11-17 23:30 UTC] remi at metacore dot net
Description: ------------ Observed in Pager 2.3.4. When using the method 'POST' for pager, it would be IMHO better to use 'javascript:void(0);' instead of '#' for the link target. This is because recent browsers do absolutely nothing when confronted with javascript:void(0), whereas when you have '#' therein, often the browser will jump to the top of the page/move around in an unanticipated manner. It's a straightforward change, I think, and one that could be made to the core package without fear of breaking things. To make this code change is a one-line modification. Line 669 of Pager/Common.php is modified from: return sprintf('<a onclick=\'%s\' href="#"%s title="%s">%s</a>', to: return sprintf('<a onclick=\'%s\' href="javascript:void(0);"%s title="%s">%s</a>', Expected result: ---------------- With javascript:void(0), the browser doesn't do anything except for load the next page, which would be my preference. Actual result: -------------- Any POST method use of Pager will demonstrate this, depending on the browser used. Firefox 1.0.7 demonstrates it (click on a pager link at the bottom of a page when the Pager method is 'POST') -- it will jump to the top of the page before actually following the javascript commands and loading the next page. This is disconcerting, IMHO.

Comments

 [2005-11-29 16:10 UTC] User who submitted this comment has not confirmed identity
If you submitted this note, check your email.If you do not have a message, click here to re-send
MANUAL CONFIRMATION IS NOT POSSIBLE.  Write a message to pear-dev@lists.php.net
to request the confirmation link.  All bugs/comments/patches associated with this

email address will be deleted within 48 hours if the account request is not confirmed!