Hi, lately I am having this problem with Internet Explorer 8:
The language switcher dropdown locks on one language, so it doesn't allow me to switch to any other language (I can choose one, but nothing happens). I am not sure whether this problem has been there all the time because personally I normally user other browsers. So it might be because of a conflict with another module I have installed lately.

However, I am not having the problem with Google Chrome and Firefox. When I activate the standard language swithcer in IE, it also works fine.

Can you reproduce this? Or do you have any idea what might be the cause?

Comments

lpalgarvio’s picture

having same issue

worse if you don't define paths for some languages.

mohammed j. razem’s picture

Status: Active » Closed (works as designed)

The bug seams to be with IE7/IE8 not Language switcher dropdown.

See http://www.jeepstone.co.uk/2009/06/10/ie8-html-dropdown-opens-pop-up-blo...

I have the same issue on my IE8 running as Virtual Machine. It's because of bad plugins or conflicting dlls.

LarsKramer’s picture

Thanks for the information. I never used the software described in the link. However, I just reinstalled Language switcher dropdown and ATM I am no longer able to reproduce the error with IE8. Let's hope it stays that way :-)

yannickoo’s picture

Status: Closed (works as designed) » Needs review
StatusFileSize
new744 bytes

The problem is that document.location.href doesn't work in IE <= 8. I attached a patch which provides a IE fallback.

manfer’s picture

Version: 6.x-1.2 » 6.x-1.x-dev
StatusFileSize
new435 bytes

It is just much easier to use window.location instead of document.location which solve the issue for older Internet Explorer versions.

manfer’s picture

Version: 6.x-1.x-dev » 7.x-1.x-dev

Pushed to 6.x-1.x development branch. Same problem needs to be solved in 7.x version.

manfer’s picture

manfer’s picture

Status: Needs review » Fixed

Pushed to 7.x-1.x development branch.

yannickoo’s picture

Status: Fixed » Needs review

Sorry manfer but you patch doesn't work. I tested in in Internet Explorer 7 and 8. When I'm using my patch it works. I think it's necessary to create the a element and trigger a click on it.

manfer’s picture

This would need further test to find what is failing in your site but as far as I know and as I tested, nor IE8 nor IE7 have any problem with window.location, and though it is safer to use that one, even document.location should work either I think.

I would need a link to try to further investigate what's wrong.

To be totally sure about window.location would be easy to test in your IE8 if it has that object correctly available. Just in your IE8 menu select Tools->Developer tools (shortcut F12) and in the window that popups go to Script tab and at the right in the console type in the textbox:

window.location.href="http://drupal.org"

and hit run script. That should redirect to drupal.org.

Similar test can be done with document.location.href.

If those tests does not work in your IE8 or IE7 then I don't know what's wrong.

A link to inspect it would be of help.

yannickoo’s picture

I tested it with a jsbin and both methods work but the language switcher doesn't work with them.

manfer’s picture

So if window.location works it is not the problem. The next thing to check would be the values of the options in the select to find if there is something wrong with them that the code does not like. -though a link tag href seems have no problem about those values-. You can check which are those values running the following script in a console:

$('#edit-lang-dropdown-select')[0].options[0].value

for the first option.

$('#edit-lang-dropdown-select')[0].options[1].value

for the second option... and so on...

Though I can't see anything wrong on that right part of the assigment:

document.location.href = this.options[this.selectedIndex].value;

as all this would be the same value:

this.options[this.selectedIndex].value;
$(this).val();
this.value;

you can try anyway to change that line of code to:

window.location.href = $(this).val();

to test what happens as that's the syntax you are using to assign the value to the link href attribute.

Other possibility that comes to my mind is if you have some kind of software that blocks javascript redirections like those ones.

yannickoo’s picture

It's right that

this.options[this.selectedIndex].value;
$(this).val();
this.value;

has the same value. I played with window.location, window.location.href, location.href, $(window).attr('location') and it doesn't work on my site. As I tested a jsbin with the same functionality it works. I don't know what is wrong on my site but the only way which works is creating an a element and trigger a click on it.

I think we should rewrite the module so that it also works without javascript. Why not using links which looks like a select list? I saw that the drupal 7 version uses a form with a go button. That's quite a better way but not a select list that only works with javascript.

Is this issue closed (fixed) now? I really would know the reason why it doesn't work...

manfer’s picture

I would need a link to the site where it does not work to look if I can find the problem.

About making it work without javascript, it already should. When javascript is disable the switcher is no more than a form with a select input and a button. When the button is clicked the form is submitted triggering a POST request to the server that redirects to the new selected language. Both in 7.x and 6.x versions of the module.

  $form['submit'] = array(
    '#type' => 'submit',
    '#value' => t('Go'),
    // The below prefix & suffix for gracefull fallback if JavaScript was disabled
    '#prefix' => "<noscript><div>\n",
    '#suffix' => "\n</div></noscript>",
  );
yannickoo’s picture

Oh, I didn't know that, sorry. Nice idea with the noscript ;)

manfer’s picture

Status: Needs review » Closed (cannot reproduce)