0

Im looking for some guidance on a responsive site design written using Bootstrap 3.

Basically I want the mobile version to be as lightweight as possible and only load JS and HTML that is necessary for the mobile view, and not load assets required for the desktop view. I would like to ignore loading specific JS files when the page is loaded via a mobile device.

Is there a simple method to do this with Bootstrap?

My guess is that I need a Javscript function to detect the device and use that as a trigger, however I was wondering if Bootstrap had this capability that I could use?

Appreciate any thoughts.

Ben
  • 6,026
  • 11
  • 51
  • 72

2 Answers2

1

It seems there is already answer to detect mobile browser with javascript. Detecting a mobile browser Otherwise you can detect the mobile device by using http_user_agent to decide not to load assets when the page is loading. Here is already answer to detect mobile device with php. Check if PHP-page is accessed from an iOS device

Community
  • 1
  • 1
emil
  • 6,074
  • 4
  • 30
  • 38
0

You can perhaps do it by user agent. There is an answer here that might help Load a javascript file and css file depending on user agent

Community
  • 1
  • 1
TGH
  • 38,769
  • 12
  • 102
  • 135