1

I use jquery-style-switcher.js for change style some of elements.In this case i must specify the full path of style sheet files in root website.In the page source of this page another css files has link such as this:

/dnn_test/Portals/_default/Skins/Crew/css/style.css

and I use this full path for switcher

 fullPath: '/DNN_test/Portals/_default/Skins/Crew/css/'

But when run website switcher can not load the files.Please advice.

hmahdavi
  • 2,250
  • 3
  • 38
  • 90

3 Answers3

2

You can do like this :

If you are using PHP and any other language. just get webroot path in PHP and echo that in html tag and get that html tag value using javascript.

Example :

You can also write static URL in href attribute.

Write Code in html file :

<base style="display:none" href="<?php echo $_SERVER['DOCUMENT_ROOT'];?>">

Write code in jquery file :

var baseUrl = $('base').attr('href');
Monty
  • 1,110
  • 7
  • 15
1

The window.location object has the following properties :

considering the exmaple referrer :

document.referrer; 
"http://stackoverflow.com/questions/2668005/jquery-get-url-path#footer"

 location:{

  hash: "#footer"
  host: "stackoverflow.com"
  hostname: "stackoverflow.com"
  href: "http://stackoverflow.com/questions/2668005/jquery-get-url-path#footer"
  origin: "http://stackoverflow.com"
  pathname: "/questions/2668005/jquery-get-url-path"
  port: "" 
  protocol: "http:"
 }

You can use location.pathname, and the empty default http port is 80

For jquery use :

Tyr to remove / from the '/DNN_test/Portals/_default/Skins/Crew/css/' so it will look like:

DNN_test/Portals/_default/Skins/Crew/css/
Bhavin Solanki
  • 4,740
  • 3
  • 26
  • 46
0

I'm not sure but you probably use linux and paths are case-sensitive in linux so use this path and tell us the result:

/dnn_test/Portals/_default/Skins/Crew/css/
MSS
  • 3,520
  • 24
  • 29