Background of the issue:
I am trying to use the language switcher on my website hidden link. I want to ensure that users can select a language without the page reloading prematurely.
Symptoms:
The language switcher reloads the page when clicked on mobile, preventing me from selecting the desired language.
Questions:
How can I prevent the page from reloading when the language switcher is tapped on mobile?
Is there a way to make the language switcher work on mobile as it does on desktop?
Languages: English (English )Spanish (Español )German (Deutsch )
Timezone: Europe/Madrid (GMT+02:00)
Hi,
I wasn’t able to reproduce the issue. I used the language switcher located within the hamburger menu. Could you provide more details? Did you use the language switcher behind the logo instead? If so, could it be redirecting the URL from the image to the homepage?
This is an old problem, it has been there for years. I switched to elementor now and it is still here.
If you go to the site from a mobile device and click on the language switcher from the drop down menu and then click on the current language to reveal other languages in the dropdown it reloads the current language.
Languages: English (English )Spanish (Español )German (Deutsch )
Timezone: Europe/Madrid (GMT+02:00)
Hi Alexander,
thanks for the infos. If I hadn’t visited your site, I wouldn’t have known you have two language switchers :). Here’s what I was able to reproduce:
1) Clicking on German opens the .de version.
3) Clicking back to English reloads the EN version.
- I can reproduce this using the Debug Tools with a Mobile breakpoint too.
- on a real mobile device it happens too, but I click the EN button faster, it's possible to click it before the refresh happens.
Do you have a staging environment where we can isolate the issue and run some tests? You could either replicate it using subdomains or set up a test instance pointing to "fake" domains via your local host file.
Yes, thank you for checking the site. I was fiddling with the switchers all day trying to figure out the issue and having a different switcher in place as a replacement but coulnd not get that to work right too. I will remove the second switcher right now.
As for the staging environment I do not have but it should be ok to work on the live site I suppose. Creating a staging environment will take hours for me 🙁
If I am fast on the desktop - yes I can click on the needed language.
On the mobile device (iPhone) I cannot do that, once the dropdown is tapped it will proceed loading it even if I tap on the right language.
I was able to find this thread before I contacted with someone having the same issue, the link was shared but it was not posted in the original message.
The thread suggested that a custom css should be added:
.mobilex-menu .wpml-ls-current-language a {
pointer-events: none;
cursor: default;
}
I tried to add it through elementor for the whole site and in WPML settings but nothing works, the switcher still reloads the page.
Languages: English (English )Spanish (Español )German (Deutsch )
Timezone: Europe/Madrid (GMT+02:00)
Hi,
The CSS is correctly loaded in the site's source code, but it does not appear to be related to or a solution for this issue. The "mobilex" menu seems to originate from another theme or a third-party plugin.
I see, it seemed to me like the correct CSS code for the issue.
Not sure what you mean by "mobilex" menu seems to originale from another theme or a third-party plugin.
This problem has been existent on all my sites since the beginning. I reinstalled the site numerous times throughout the last 6 years and this menu was always like this. Regardless of the theme.
Do you have a correct CSS code to disable the click?
Languages: English (English )Spanish (Español )German (Deutsch )
Timezone: Europe/Madrid (GMT+02:00)
The "mobilex" you mentioned is part of a class name you shared, most likeley specific for a theme used in that case you checked. Unfortunately, I can't provide a workaround without further debugging and isolating the issue. We'll need access to a staging environment or duplicator copy to continue testing and determine the source of this refresh behavior.
Best regards,
Marcel
The topic ‘[Closed] Language Switcher’ is closed to new replies.