سؤال

I'm using the Razor v2 template engine to render an HTML page from WPF but getting an error from JavaScript within the template. The offending code is below:

13    <script type="text/javascript">
14      var ie7 = (document.all && !window.opera && window.XMLHttpRequest) ? true : false;
15      if(!ie7){
16          WebFontConfig = {
17              google: { families: [ 'Droid Serif', 'Droid Sans', 'Satisfy', 'PT Sans' ] }
18          };
19      (function() {
20          var wf = document.createElement('script');
21          wf.src = ('https:' == document.location.protocol ? 'https' : 'http') +
22          '://ajax.googleapis.com/ajax/libs/webfont/1/webfont.js';
23          wf.type = 'text/javascript';
24          wf.async = 'true';
25          var s = document.getElementsByTagName('script')[0];
26          s.parentNode.insertBefore(wf, s);
27          })();
28      }
29      </script>

The error is:

{c:\Users\Echilon\AppData\Local\Temp\0sdz13xb.0.cs(15,28) : error CS1002: ; expected}

I've tried wrapping the script section in <text> tags to no avail.

هل كانت مفيدة؟

المحلول

I ended up using the Spark view engine instead, which supports <ignore> tags to specify text to ignore.

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top