Using Activemenus in IE, if starting from a first level page, you try to expand two levels of menus, you get a script error and nothing happens.
Steps to reproduce in a typical navigation menu setup:
- Expand Administer
- Try to expand Logs
Observe that it doesn't expand, and instead you get this script error (replace example.com with your domain):
Line: 54
Character: 17
Code: 0
Error Message: 'length' is null or not an object
URL: http://example.com/Note that Activemenus continue to work after the script error (though you still can't expand 2nd level nodes).
Note also that if the first level menu was already expanded when you loaded the page, Activemenus will happily load the second level menu. It's only if you dynamically load the first level then second level menu in one go!
Affected browsers: IE6 and IE7
Not affected: Fx1.5, Fx2, Opera9 [though see http://drupal.org/node/140585 re Opera]
Themes tested: Pushbutton, Bluemarine
I was unable to test this with Garland in IE6 or IE7 due to two separate bugs I just filed.
| Comment | File | Size | Author |
|---|---|---|---|
| #2 | jstools_support_absolute_path_140620.patch | 1.3 KB | Jomel |
Comments
Comment #1
nedjoThis problem seems to come from two bugs in IE.
The first is that getAttribute('href') returns the absolute href, not the href that's actually in the code. I've used a workaround, feeding a proprietary Microsoft 2nd argument to getAttribute. So the initially-loaded links work.
The 2nd problem is that when appending content IE seems to rewrite the URLs from relative to absolute. So the workaround doesn't work here--links are always absolute.
I'll have a look at whether we can add support for absolute URLs. Probably need to pass the base_url value.
Comment #2
Jomel commentedHere's a quick fix so getPath supports absolute URIs:
I also took out the proprietary argument to getAttribute which is no longer needed.
It fixes the issue in IE5.5, IE6 and IE7.
I've tested briefly in Fx1.5, Fx2 and Opera9 and can't see any regressions.
I didn't check the other code much, but you might want to update prependPath for parity, I'll leave you to decide.
P.S. Thanks for the quick review of my other patches!
I'm only just starting out with Drupal, so CVS access is still a while off, but thanks for the offer :)
Comment #3
Jomel commentedComment #4
nedjoMuch appreciated. Applied.
Comment #5
Jomel commentedThanks. Just a quick note on your comment in the source though:
It doesn't remove (e.g.) "http://", it removes the whole "http://www.example.com"
Comment #6
nedjoThanks, fixed. (Moved your code to a new function to enable reuse.)
Comment #7
(not verified) commentedComment #8
manuj_78 commentedSetting the code to active as I just tested activemenu and the problem with IE still exists. It works properly in firefox, but with ie7, second level menu does not load when I click on the plus sign.
I am using drupal 5.1 on a VPS