Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
Currently "nojs" in the path is used to gracefully degrade if users don't have javascript. However, the javascript regex that replaces that with "ajax" is finicky and doesn't allow for variations in the URL, such as query parameters or fragments. Here is the list of cases it should check for:
+ // 1. /nojs/
+ // 2. /nojs$ - The end of a URL string.
+ // 3. /nojs? - Followed by a query (with clean URLs enabled).
+ // E.g.: path/nojs?destination=foobar
+ // 4. /nojs& - Followed by a query (without clean URLs enabled).
+ // E.g.: ?q=path/nojs&destination=foobar
+ // 5. /nojs# - Followed by a fragment.
+ // E.g.: path/nojs#myfragment
This is a backport of #565808: nojs/ajax replacement from Drupal HEAD.
Comment | File | Size | Author |
---|---|---|---|
#13 | ctools_970536.patch | 2.4 KB | Demonick99 |
#3 | ctools_970536.patch | 2.39 KB | drewish |
#2 | ctools_970536.patch | 84.74 KB | drewish |
nojs-ajax-replace-d6.patch | 2.44 KB | carlos8f |
Comments
Comment #1
drewish CreditAttribution: drewish commentedI appreciate that this moves the regex into a function. I'd be able to re-use it from Dialog module. We're currently debating what the right regex is for rewriting links. Currently it matches ctools but Dave Reid is pushing for the D7 mechanism: #1046758: Drupal.Dialog.submitAjaxForm not correctly rewriting URLs.
Comment #2
drewish CreditAttribution: drewish commentedI poked around with panels with the debugger and seemed good to me, I couldn't find any regressions.
I rerolled the patch to remove an extra semicolons from one line:
Comment #3
drewish CreditAttribution: drewish commentedYeah, ignore the other 82K of that patch.
Comment #4
Taran2L@drewish: thanks, seems like your patch works properly.
Comment #5
Blackice2999 CreditAttribution: Blackice2999 commentedHi,
same strange issue here on Firefox 3.6.17 i applied the patch and the problem is still exists and firefox calls nojs instead of ajax. The interesting is if i open the firebug (only open firebug no more) it works nojs will be replaced with ajax. if i close firebug its work until a page reload... i think this is a strange firefox issue and its hard to debug it without firebug :D
regards
Dennis
Comment #6
Taran2L@Blackice2999, probably you have console.log() somewhere in the code (or other console object use), without Firebug there are no console object in FF. In this case you will have uncaught JS error, which can break other code, like ctools AJAX responder.
Comment #7
Blackice2999 CreditAttribution: Blackice2999 commented@Taran2l,
thanks alot! - thats is it. From the dialog module / dialog.js:247 ...
regards
Dennis
Comment #8
Dave ReidLooks good to me if it still applies.
Comment #9
Dave ReidActually I don't like that this adds a new function - we should just replace in-line like the current code.
Comment #10
Dave ReidNevermind, I can't make up my mind.
Comment #11
merlinofchaos CreditAttribution: merlinofchaos commentedCommitted!
Comment #13
Demonick99 CreditAttribution: Demonick99 commentedIt seems to me or in the patch and the current version of the module error in the first case the function should be passed the url, and old_url?