Register Advertise with usHelp Desk Today's Posts Search

Closed Thread
Thread Tools Search this Thread
Unread 7th Apr 2016, 12:50 PM   #1
Warrior Member
 
Join Date: 2016
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default
Mobile_Detect.php switch to desktop
Share on: 
fb share twitter share gplus share more share

Hello everyone,

I have issue with switching to desktop, I`m using Mobile_Detect.php script and detection for mobile is working fine, here is the code

Code:
 inc.header.php (Desktop site)

if ($_GET['v'] == 'desktop') {

   $_SESSION["v1"] = 'desktop';


}
// Detect browser and redirect mobile users unless they've already opted out
if ($_SESSION["v1"] != 'desktop') {
    // Place browser detection and redirection code here
require_once 'Mobile_Detect.php';
$objMobile = new Mobile_Detect;
if($objMobile ->isMobile()) {

if($_SERVER['REQUEST_URI']=="/")
    {

   header('Location: http://www.website.com/m/');
    }
else
    {
 header("Location: http://www.website.com/m".$_SERVER['REQUEST_URI']);
    }
    exit;
}
}
That`s part working fine, detection is working and I`m redirected to mobile site properly. Now I have created separate part for Desktop version which looks as follow :

files :

Code:
inc.footer.php

if ($_GET['v'] == 'desktop') {

   $_SESSION["v1"] = 'desktop';


}

footer.html

<a href="http://website.com/?v=desktop">Desktop version</a></div>
Anyone can help me to get it working ?

Cheers
Greg
sterngre is offline  
Unread 8th Apr 2016, 10:16 AM   #2
Warrior Member
 
Join Date: 2016
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default
Re: Mobile_Detect.php switch to desktop
Share on: 
fb share twitter share gplus share more share

Hey anyone can help ?
sterngre is offline  
Unread 8th Apr 2016, 08:37 PM   #3
Warrior Member
 
Join Date: 2016
Posts: 14
Thanks: 0
Thanked 0 Times in 0 Posts
Default
Re: Mobile_Detect.php switch to desktop
Share on: 
fb share twitter share gplus share more share

Thanks rusilja! Yup, I'll definitely do some A/B testing when I have more visitors.

inhongdang is offline  
Closed Thread


Bookmarks

Tags
desktop, mobiledetectphp, switch


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off




All times are GMT -6. The time now is 07:05 AM.