Say someone has a webpage designed for desktops and decides they want the webpage to work properly for mobile devices. They want the desktop webpage to be left alone.

What is the script or method to detect a mobile webpage and load a new html/css for tablet/phone size . users will go to the same webpage as the desktop location and be redirected to a mobile version if need be.

This avoids the headache of making a static desktop webpage responsive.