khromov / wp-wpml-geoip-browser-language-redirect

GeoIP Redirector for WPML (WordPress)

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Redirection Not Working

emarrjpa opened this issue · comments

Hello,
I love the idea of your plugin and definitely willing to support it once I get it working.

I'm unable to get the redirect to work with WPML. I'm currently using a VPN to test the redirect, but no matter which country I use I seem to get the same version of the site.

Thanks!

This was my error log:

Uncaught TypeError: Cannot read property 'log' of undefined
at HTMLDocument. (browser-redirect-geoip.js:23)
at i (jquery.js:2)
at Object.fireWith [as resolveWith] (jquery.js:2)
at Function.ready (jquery.js:2)
at HTMLDocument.K (jquery.js:2)
(anonymous) @ browser-redirect-geoip.js:23
i @ jquery.js:2
fireWith @ jquery.js:2
ready @ jquery.js:2
K @ jquery.js:2

@emarrjpa Please try in Firefox or Chrome. console.log() should be defined. If you still have issues, try changing to a default theme and try again.

Thanks, tried different browsers and default Twenty Seventeen theme and still got the same error. Any other ideas?

console.log() not working appears to be a separate issue from this plugin, so I can't provide support for that. Maybe someone else can, so I'll leave this ticket open.

I've figured this out and now the debugger is working and it is redirecting correctly from the home page. I removed the "IE 8/9 Fix" from the top of the JS file and then the debugger worked perfectly. I do have another question...Does the redirect work for ONLY the homepage or should it work for subpages as well? For example, if I visit example.com/subpage will I get redirected to example.com/en-gb/subpage?

@emarrjpa Yes, you will be redirected if a translation for the subpage exists in the language we think the users is from based off of the geoip response.

However you will only be redirected on your very first visit to the site. A cookie is then set to prevent further redirection, because we don't want to force the user to use a specific language, just nudge them in the right, localized direction.

@emarrjpa can you please tell me how you got the solution for the redirect to work? I'm having the same issue

@yovek7 Sorry for the delay, just saw this. I removed the "IE 8/9 Fix" from the top of the JS file and then the debugger worked perfectly. Used a VPN to test the redirect and everything works perfectly.

Thanks, @khromov! Your plugin was a lifesaver!