0

I'm looking for a solution to dynamically swap out markup. I'm familiar with solutions that conditionally load and swap stylesheets, scripts, images, or blocks of HTML markup such as responsive.js, interchange.js in Foundation 5, yepnope ... tons others I'm sure.

I have a website that has a ton of content that needs to be completely replaced with a mobile version of the markup. I can definitely not load styles and scripts below the browser width in mind, but I'm looking for a good way to swap out most markup out of the DOM once it gets below that width as well. If the changes weren't so significantly different between the two versions I could just do some hacky workaround but I definitely don't want all these resources loading on a phone and don't want to just redirect to a mobile URL if browser width is below width.

Anyone know of a good way to do this?

  • You want responsive, but you don't want responsive? – Martijn Mar 27 '14 at 16:32
  • Well you cant check screen width in php, but you can check user browser, and load mobile layout when it is mobile version. This is how it is done. http://stackoverflow.com/questions/4117555/simplest-way-to-detect-a-mobile-device – MSadura Mar 27 '14 at 16:33
  • 1 database, 1 CMS, 2 domains - parse the data completely differently for mobile.yourdomain.com and www.yourdomain.com – CD001 Mar 27 '14 at 16:34
  • Actually you can. Mobile_detect does, and there are some other scripts that can – Martijn Mar 27 '14 at 16:34
  • 1
    @Martijn mobile_detect and other classes to recognize mobile device are still based on user agent, not screen width. – MSadura Mar 27 '14 at 16:36
  • Yes, and in that same script it knows the screen resolution, screen ratio, pixel-ratio and a lot of other info :) – Martijn Mar 27 '14 at 17:53
  • @Martijn Awesome, thanks. I'll definitely try that Mobile_detect. Looks perfect. – user3116162 Apr 03 '14 at 17:28

0 Answers0