我有以下
JavaScript代码作为字符串文字:
var $Page = new function() { var _url= 'http://www.some.url.com'; this.Download = function() { window.location = _url; } }
解决方法
您应该查看Codeplex上的开源Javascript .NET(
http://javascriptdotnet.codeplex.com/).
这段代码应该可以帮助您:
Javascript context = new JavascriptContext(); context.Run("var _url= 'http://www.some.url.com';") // You put your javascript in the function run String url = (String)context.GetParameter("_url"); // You get your url from javascript
而已.