New to Telerik UI for ASP.NET AJAX? Download free 30-day trial

JavaScript console error Telerik is not defined

Environment

Product Telerik UI for ASP.NET AJAX

Description

Found out the different reasons to get Telerik is not defined JavaScript error in your browser console

Error Message

  • Telerik is undefined
  • Uncaught ReferenceError: Telerik is not defined
  • Microsoft JScript runtime error: 'Telerik' is undefined
  • Uncaught ReferenceError: $telerik is not defined

Solution

To fix the above errors try the following tips:

  • Set CombineScripts="false" in the ASP.NET script manager
  • Disable the debugging in the web.config

    <compilation debug="false" targetFramework="4.8">
    
  • Disable the UnobtrusiveValidationMode in the web.config file

    <appSettings>
    <add key="ValidationSettings:UnobtrusiveValidationMode" value="None"/>
    ...
    
  • Remove the targetFramework attribute from the httpRuntime section of the web.config
    <httpRuntime requestLengthDiskThreshold="512" useFullyQualifiedRedirectUrl="true" executionTimeout="110" requestValidationMode="2.0"  maxRequestLength="102400" />
    
  • The error could be due to the login/authentication mechanisms that block resources and you need to add a element to allow access to the Telerik handlers explicitly. You can find an example here: Use Telerik Controls with ScriptManager on Login Page Throws an Error:

    <configuration>
    ...
    <location path="Telerik.Web.UI.WebResource.axd">
        <system.web>
            <authorization>
            <allow users="*"/>
            </authorization>
        </system.web>
    </location>
    ...
    </configuration>
    
  • Enable or Disable the Telerik ScriptManager CDN

    <add key="Telerik.ScriptManager.TelerikCdn" value="Enabled" />
    
  • Proxy server, Firewall, WebSense or another security/authentication program could redirect and/or wipe out the contents of the Telerik script files, and therefore to cause the Telerik is not defined error. In such scenarios where the Script Response is empty in the Network tab of DevTools or you get a status code of 307, make sure that the Telerik CDN is disabled or set the following URLs to the allowed proxy list of URLS so that these resources pass through the proxy unmodified:

    http://aspnet-scripts.telerikstatic.com - for the scripts;
    http://aspnet-skins.telerikstatic.com - for the skins (CSS and images);
    https://d2i2wahzwrm1n5.cloudfront.net - for the scripts;
    https://d35islomi5rx1v.cloudfront.net - for the skins (CSS and images);
    

See Also

In this article