0

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";

        }

enter image description here

1 Answer 1

1

For styling you can just do it this way.From Razor view it shall be able to load all the style elements that you want.

<link href="../../AppStyles/templatemo_style.css" rel="stylesheet" type="text/css" />
Sign up to request clarification or add additional context in comments.

1 Comment

Thanks for your reply but I could not undersatnd your answer

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.