I wonder is this a correct way to do I have an application used to target mobile, tablet and browser. In javascript I'm using. this is working in html page. Now I have migrated this app in in asp.net mvc 4 and to work it properly I defined rootpath variable and assigned it "../". and concatenated it as shown below structure of project is given in image. I want to use it in index.cshtml view which is also my default view.
var userAgent = window.navigator.userAgent;
var rootpath ="../";
if (userAgent.indexOf("iPhone") >= 0 || userAgent.indexOf("iPad") >= 0) {
isiOS = true;
}
if (userAgent.indexOf("Android") >= 0 || userAgent.indexOf("iPhone") >= 0) {
isMobileDevice = true;
dojo.byId('dynamicStyleSheet').href = rootpath + "styles/mobile.css";
}
else if (userAgent.indexOf("iPad") >= 0) {
isTablet = true;
dojo.byId('dynamicStyleSheet').href = rootpath + "styles/tablet.css";
}
else {
isBrowser = true;
dojo.byId('dynamicStyleSheet').href = rootpath + "styles/browser.css";
}
