Any smart way of doing a "root" based path referencing in JavaScript, just the way we have ~/ in ASP.NET?
~/
Have your page generate a tag with something like:
<link rel="home" id="ApplicationRoot" href="http://www.example.com/appRoot/" />
Then, have a function in JavaScript that extracts the value such as:
function getHome(){ return document.getElementById("ApplicationRoot").href; }
548k questions
547k answers
4 comments
86.3k users