What's the correct way to pass in tilde path in javascript in order to get the relative path?
<p>I have a tilde path. I would like to convert it into client url</p>

<pre><code>    var path = "~/Presentation/Resources/Images/masterPage/cleanup.png";
    var a =  '&lt;%=Page.ResolveClientUrl(" '+path+' ") %&gt;';

    var b = '&lt;%=ResolveUrl("~/Presentation/Resources/Images/masterPage/cleanup.png") %&gt;';

alert("var a--&gt;"+a);
alert("var b--&gt;"+b);
</code></pre>

<p>although the code above seems the same, the results I obtain for var a and var b are very different.</p>

<p><strong>Result</strong></p>

<pre><code>var a --&gt; ~/Presentation/Resources/Images/masterPage/cleanup.png
var b --&gt; ../../Resources/Images/masterPage/cleanup.png
</code></pre>

<p>I have a variable that stores the path, but I failed to get the result exactly like var b.
What can I do for <strong>var a</strong> so that I can get the result like <strong>var b</strong>?</p>
