0

How can I refer root path in Javascript like:

$.blockUI.defaults.growlCSS['background'] = 'url(~/Styles/images/check48.gif) no-repeat 10px 10px #000; ';
2
  • 4
    A path starting with / always refers to the root of your site (not the folder). If you have a <base> tag set in HTML, you don't need the first /. Commented Nov 9, 2012 at 9:24
  • what if i use virtual directory ? Commented Nov 9, 2012 at 9:26

1 Answer 1

1

Biju was wondering how to solve this in javascript, a way to do it is:

var path = window.location.protocol + '//' + window.location.host + '/'; // or whatever you want to set it to
$.blockUI.defaults.growlCSS['background'] = 'url(' + path + 'Styles/images/check48.gif) no-repeat 10px 10px #000; ';
Sign up to request clarification or add additional context in comments.

Comments

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.