0
votes

The application on which m working I am calling CSS file from remote server dynamically and remote server side we are using node.js where file loads but not apply CSS on the page.

When I try to add the path other than node.js server path it works properly and when I add some CSS from javascript this also works.

I tried following option

  1. loadCSS = function(href) { var href = "http://192.168.0.64:3001/public/stylesheets/enduserchat.css"; var cssLink = $(""); $("head").append(cssLink); }; // not working

  2. $('head').append('http://192.168.0.64:3001/public/stylesheets/enduserchat.css" type="text/css" />') // (remote side node.js) not working

  3. $('head').append('http://demo23.easternenterprise.com/webrtc/css/chats.css" type="text/css" />') // working (without node js)

  4. function loadjscssfile(filename) { var fileref=document.createElement("link"); fileref.setAttribute("rel", "stylesheet"); fileref.setAttribute("type", "text/css") fileref.setAttribute("href", "http://192.168.0.64:3001/public/stylesheets/enduserchat.css") document.getElementsByTagName("head")[0].appendChild(fileref); } // not working

Plz help me out for this.

1

1 Answers

0
votes

As I see, you are loading the css after creation of the webpage. But changes will work AFTER refreshing of the webpage. The solution: at server side combine all styles, javascript and html, and after that return it to the client side.

Have a nice day!