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] quipo
This bug has been fixed in CVS. If this was a documentation problem, the fix will appear on pear.php.net by the end of next Sunday (CET). If this was a problem with the pear.php.net website, the change should be live shortly. Otherwise, the fix will appear in the package's next release. Thank you for the report and for helping us make PEAR better.