This object is in archive! 

Can not switch between Desktop and Mobile

Archived Jared R. 11 years ago

I have users who originally selected desktop and now are not able to switch back to mobile on their phone/tablet. Can you tell me how to allow them to switch between the to modes?

Replies (10)

photo
1

Jared,

I guess the problem is in cookies. UseResponse remembers the user's choice to prevent asking about it each time. Clean cookies will fix it.

We will make this mechanism more convenient in release 3.0.

photo
1

Is it possible for me to manually add a link or something until this feature it added?

photo
1

Yes, but as for now you can do it with some hacks:


  1. Open file: /application/modules/system/controllers/IndexController.php
  2. Then find line: public function useMobileInterfaceAction()
  3. Replace the whole action with:

  1. public function useMobileInterfaceAction()
  2. {
  3. if ($this->_getParam('reset')) {
  4. Singular_Core::_('Theme')->clearAllOverrides();
  5. $this->_helper->redirector->gotoUrl($this->getFrontController()->getBaseUrl());
  6. }
  7. Singular_Core::_('Theme')->overrideDefault('mobile');
  8. $this->_forward('index');
  9. $redirect = $this->_getParam('redirect');
  10. if (!empty($redirect)) {
  11. $this->_helper->redirector->gotoUrl($redirect);
  12. } else {
  13. $this->_helper->redirector->gotoUrl($this->getFrontController()->getBaseUrl());
  14. }
  15. }

Now you can use this link for switching from mobile theme to system default:

  1. <a href="http://<your_site>/use-mobile-interface?reset=true">Switch to Full Site</a>

photo
1

Ok thanks,


Two questions now, when is version 3 coming out like soon or do we still have a good wait? And will this code mess up anything when I update or will it just be replaced with whatever solution you guys include?

photo
1

Jared,

We are talking about several months here, though we don't give exact dates on upcoming releases until we are sure it's polished and ready to go live.

Your code will be overwritten because it's a hack.

You can and should consider developing of custom module for your changes to be saved from version to version

photo
1

Ok I have added in the needed code to allow me to switch to desktop but it does not seem to be switching from desktop to mobile. Do I need to add in something or is that a different link?

photo
1

This code allows you from mobile to desktop version only.

More flexible system will be integrated in 3.0 release.

photo
1

Can you give me the code to allow fro desktop to mobile? I do understand that it will be better in 3.0 but as Stas said, it could be several months and my users are Android users so we need the option to switch between the two views.


If you told me you will push a minor update this week that allows for this by all means I would wait. I just need this sooner then later.

photo
2

Solution is pretty simple. Use almost the same line of code just without ?rest=true to get from Desktop to Mobile version:

  1. <a href="http://<your_site>/use-mobile-interface">Switch to Mobile Site</a>

photo
1

Thank you sir!

Replies have been locked on this page!