Revision: 50951
Initial Code
Initial URL
Initial Description
Initial Title
Initial Tags
Initial Language
at September 9, 2011 20:14 by plugables
Initial Code
Url = function() { } Url.prototype = { _relativeRoot: '<%= ResolveUrl("~/") %>', resolve: function(relative) { var resolved = relative; if (relative[0] == '~') resolved = this._relativeRoot + relative.substring(2); return resolved; } } $Url = new Url(); //Now, anywhere I need to resolve a relative url in a script, I can do this: var logoUrl = $Url.resolve("~/Images/logo.png");
Initial URL
http://iridescence.no/post/Resolving-relative-URLe28099s-from-JavaScript.aspx
Initial Description
Initial Title
Resolve relative Urls from Javascript (for ASP.NET)
Initial Tags
url, aspnet
Initial Language
JavaScript