Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

tablet_host parameter not working when not equal to mobile_url & continuous redirect to my tablet_host #36

Open
WChoy opened this issue Jan 10, 2013 · 0 comments

Comments

@WChoy
Copy link

WChoy commented Jan 10, 2013

Please add the Microsoft Surface (that no one is going to buy) with for the agent = "Mozilla/4.0 (Compatible; msie 7.0; windows nt 6.2; arm; trident/6.0; touch; .net4.0e; .net4.0c; tablet PC 2.0; Version)"; // Microsoft surface.

We should be safe to add "tablet" in the agent match pattern.

I was getting a continuous redirect to my tablet_host, because you where checking the referrer to only the mobile_host. The fix was move the isUATablet test before setting the cookies/session and the change the test to
(isUAMobile && document.referrer.indexOf(mobile_host) >= 0 )
|| (isUATablet && document.referrer.indexOf(tablet_host) >= 0) || ....

Oh .. your setting either the session OR cookie variable. So the final test for the redirection should be "&& !isCookieSet && !isSessionStorage" not !(isCookieSet || isSessionStorage).

William Choy
NorthPoint Solutions

PS: Here is the patch (Sorry for the funky formatting):

Index: js/redirection-mobile.js

105a106,113

// Check if the device is a Tablet such as iPad, Samsung Tab, Motorola Xoom, Amazon Kindle or MS Surface
if (!!(agent.match(/(iPad|SCH-I800|xoom|NOOK|silk|kindle|GT-P7510|tablet)/i))) {

  // Check if the redirection needs to happen for tablets
  isUATablet = (config.tablet_redirection === TRUE || !!config.tablet_host) ? true : false;
  isUAMobile = false;

}

109c117

< if (document.referrer.indexOf(mobile_host) >= 0 || queryValue === FALSE ) {

if ((isUAMobile && document.referrer.indexOf(mobile_host) >= 0 ) || (isUATablet && document.referrer.indexOf(tablet_host) >= 0) || queryValue === FALSE ) {
129,136d136
< // Check if the device is a Tablet such as iPad, Samsung Tab, Motorola Xoom or Amazon Kindle
< if (!!(agent.match(/(iPad|SCH-I800|xoom|NOOK|silk|kindle|GT-P7510)/i))) {
<
< // Check if the redirection needs to happen for tablets
< isUATablet = (config.tablet_redirection === TRUE || !!config.tablet_host) ? true : false;
< isUAMobile = false;
< }
<
138c138

< if ((isUATablet || isUAMobile) && !(isCookieSet || isSessionStorage)) {

if ((isUATablet || isUAMobile) && !isCookieSet && !isSessionStorage) {

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant