- This topic is empty.
July 30, 2013 at 1:06 pm #145216
A week or so ago, I was looking for a solution to redirect our users from our classic site to our mobile site if they were on a mobile device. I found a JS on Github, that appeared to work perfectly – see the thread.
I had originally tested the script using the following devices LG Optimus G with Android 4.1, iPhone4 with most recent version OS, iPad with an unknown OS version, and a Samsung Galaxy Note2 with unknown OS version. They had all worked perfectly with in our internal network and without.
But now, a week later, I’m getting reports that some of our users on our internal wireless network are getting stuck in an endless “loading loop”, where it never actually redirects to the mobile site.
So far we’ve noted the following devices iPad with the most recent version OS, a Samsung Galaxy S1 running Android 2.3 and a Motorola Xoom running Android 4.1. All are using the browsers that came with their OS.
I’m concerned that these specific devices (their OS or their user agents) are not included in the script.
I’m totally new to this mobile stuff and I’m hardly a JS guru. (I’m mainly a designer!) So I’m having a hard time interpreting the code that I think is defining this information. Line 102?
I could use some insight, if anyone has the time. Thanks!July 30, 2013 at 1:35 pm #145219AlenParticipant
Line 102 is Regular Expression from http://detectmobilebrowsers.com make sure you keep the two in sync. Thing with User-Agent sniffing is that you have to keep this up-to-date.
You should also probably submit issue here: https://github.com/sebarmeli/JS-Redirection-Mobile-Site so that developers can take a look.July 31, 2013 at 8:57 am #145277
@Alen I had noted that the http://detectmobilebrowsers.com link was referenced in the code and checked it, but all I saw was the message that “No mobile browser detected.`Mozilla/5.0 (compatible; MSIE 10.0; Windows NT 6.1; WOW64; Trident/6.0)”, which is obviously my desktop browser info. I didn’t think about clicking on the buttons to get scripts. Told you I’m new at this. Doh!
I updated the user-agents, and that seems to have stopped the endless loading loops, but now the redirection has completely stopped for all devices as well. =(
I did go and submit the issue on Github. ThanksAugust 7, 2013 at 1:50 pm #146043
The author has still not responded, but no matter.
I figured out the issue with why the redirection had stopped. When I had updated the user-agents, it changed a reference of “agent” to “a” in two places. So my script had to have those same references updated as well.
Those changes were added on lines 54 (55) and 133 (134) on my CodePen.
I also discovered that if tablet_redirection parameter is defined as “false” then the tablet_host parameter is not necessary and that is what was causing the infinite loading loop on some devices.
Problem solved. =)