How to show ViewMobileVersion on Desktop ?

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.
10 years ago
Hi,
Is there a way to display View Mobile Version on the desktop. I found code below, but maybe I do not fully understand what is happening.
J.


     [ChildActionOnly]
        public ActionResult ChangeDeviceBlock()
        {
            if (!_mobileDeviceHelper.MobileDevicesSupported())
                //mobile devices support is disabled
                return Content("");

            if (!_mobileDeviceHelper.IsMobileDevice(_httpContext))
                //request is made by a desktop computer
                return Content("");

            return View();
        }

<div class="change-device">
    <a data-ajax="false" href="@(Url.RouteUrl("ChangeDevice", new { dontusemobileversion = false }))">
        @T("Mobile.ViewMobileVersion")
    </a>
</div>


10 years ago
Personally I would not change code as this can be done via a browser plug in

https://chrome.google.com/webstore/detail/user-agent-switcher-for-c/djflhoibgkdhkhhcedjiklpkjnoahfmg

for chrome will do exactly what you are looking to do

Hope this helps

Jonathon
10 years ago
jmusters wrote:
Personally I would not change code as this can be done via a browser plug in

https://chrome.google.com/webstore/detail/user-agent-switcher-for-c/djflhoibgkdhkhhcedjiklpkjnoahfmg


Also check out Opera Mobile Emulator, which takes into account screen size and such.
10 years ago
Hi,

Maybe I was not clear enough. Since I do not purchase a license of 51degrees , tables are not detected and thus iPad is presented the mobile version instead of the tablet/ regular site. This might happen for more tables I assume. So is it possible to show on a desktop version that there is a mobile site as well? Like 'Visit mobile site' if the desktop version is shown? I have the feeling the code is there, but for some reason no label is present to render 'visit mobile site'. Where to add this label? I can add it to language, but where to put the translation code?

J.
10 years ago
Quantis001 wrote:
Hi,

Maybe I was not clear enough. Since I do not purchase a license of 51degrees , tables are not detected and thus iPad is presented the mobile version instead of the tablet/ regular site. This might happen for more tables I assume. So is it possible to show on a desktop version that there is a mobile site as well? Like 'Visit mobile site' if the desktop version is shown? I have the feeling the code is there, but for some reason no label is present to render 'visit mobile site'. Where to add this label? I can add it to language, but where to put the translation code?

J.


Yeah, those 'tweeners are a pain. I think mobile is not what you are looking for... more like responsive design, which might adapt to screen size, orientation, etc, etc. The latest 3.30 discussion thread discusses this to some detail.

In any event, you could sort of hack together a solution by putting a link 'Show Other Theme', which merely forces a different theme, but... I'm not sure if that would work that way I'm thinking it should.
10 years ago
There is a setting which allows emulating a mobile layout on desktop browser:  

storeinformationsettings.emulatemobiledevice

By default it is set to False but you can set it to True using the backoffice menu: Configuration > Seetings > All Settings(advanced)
This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.