0

WinJS or MobileFirst is injecting this piece of code on my index.html, the problem is ui-light.css is messing up with my .css even though it is the very first <link> on the <head> Is there a way to remove this .css injection? I'd rather avoid doing javascript to remove a code that was just injected by javascript.

<script>
            var head = document.getElementsByTagName('head')[0]; 
            if (window.clientInformation.userAgent.indexOf("Windows Phone 8.1") > -1) {
                var fileref1 = document.createElement("script"); 
                var fileref2 = document.createElement("script"); 
                var link = document.createElement('link'); 
                fileref1.setAttribute("type", "text/javascript"); 
                fileref1.setAttribute("src", "//Microsoft.Phone.WinJS.2.1/js/base.js"); 
                fileref2.setAttribute("type", "text/javascript"); 
                fileref2.setAttribute("src", "//Microsoft.Phone.WinJS.2.1/js/ui.js");
                link.setAttribute("rel", "stylesheet"); 
                link.setAttribute("href", "//Microsoft.Phone.WinJS.2.1/css/ui-light.css"); 
                head.appendChild(fileref1); 
                head.appendChild(fileref2); 
                head.appendChild(link); 
             } else {       
                var fileref1 = document.createElement("script"); 
                var fileref2 = document.createElement("script"); 
                var link = document.createElement("link"); 
                fileref1.setAttribute("type", "text/javascript"); 
                fileref1.setAttribute("src", "//Microsoft.WinJS.2.0/js/base.js "); 
                fileref2.setAttribute("type", "text/javascript"); 
                fileref2.setAttribute("src", "//Microsoft.WinJS.2.0/js/ui.js"); 
                link.setAttribute("rel", "stylesheet"); 
                link.setAttribute("href", "//Microsoft.WinJS.2.0/css/ui-light.css"); 
                head.appendChild(fileref1);
                head.appendChild(fileref2);
                head.appendChild(link);
            }
        </script>

1 Answer 1

0

The latest version of winJS was 4.4. The ui-light/dark.css file was included in the WinJS library as a standalone css file. You can choose not to add it if it was messed up with your css. So, please try to update to winJS 4.4.

Sign up to request clarification or add additional context in comments.

1 Comment

Hi @Xavier, thanks for the quick response! Unfortunately I can't move away from this version (2.0) due to other project dependencies.

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.