SyntaxError Occurs in the Browser
Environment
| Product | Progress® Telerik® UI for ASP.NET AJAX AjaxManager | Progress® Telerik® UI for ASP.NET AJAX AjaxPanel |
Description
Depending on the browser, the following errors occur:
-
SyntaxErrorin Internet Explorer -
Uncaught SyntaxError: Failed to execute 'insertRule' on 'CSSStyleSheet': Failed to parse the rule'in Chrome -
SyntaxError: An invalid or illegal string was specifiedin FireFox
Cause
The cause for these errors are the commented CSS rules in the <head> of your page, for example, /* .someClass { display: none; } */. The AjaxManager and Ajaxpanel update the <head> of the page to enable controls to register stylesheets and scripts during an AJAX request. Such commented rules cannot be parsed by the engine.
Solution
To solve this issue, use any of the following approaches:
-
Set the
EnablePageHeadUpdateproperty of the Ajax control tofalse. -
Remove the commented CSS rule or move it to a separate stylesheet file.
-
Place the styles settings in external CSS files.