Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 16 additions & 0 deletions troubleshooting/js-errors.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ If you get such errors, the reason may be:

* [The `telerik-blazor.js` JS Interop file is missing or the URL is wrong](#missing-file)
* [The `defer` attribute causes the script to load and execute too late](#defer-attribute)
* [A required order of the HTML tags in the web page](#html-tags-order)
* [TypeScript `exports` workaround break Telerik Blazor](#typescript)
* [A result of a syntax error in old browser](#syntaxerror-unexpected-token)

Expand All @@ -57,6 +58,21 @@ Sometimes, the JS Interop file is referenced correctly and returns successfully,

One solution is to remove the `defer` attribute of the `<script>` tag that registers `telerik-blazor.js`. On the other hand, `defer` improves the performance of your app by loading the script asynchronously. That's why a better option is to [keep the `defer` attribute and start the client-side Blazor framework manually]({%slug getting-started/what-you-need%}#javascript-file).

### HTML Tags Order

You can get the error when the application is navigating from an interactive page. If this is the case, register the `telerik-blazor.js` after the `<base href="/" />` in the `<head>` of the web page:

<div class="skip-repl"></div>

```HTML
<head>
...
<base href="/" />
<script src="_content/Telerik.UI.for.Blazor/js/telerik-blazor.js" defer></script>
...
</head>
```

### TypeScript

By default, TypeScript results in compiled code that needs the `exports` object, and that is not available in Blazor by default, so it throws an error. A common workaround for that (defining an empty `exports` object) causes errors from the Telerik JS Interop files. You can read more about the errors and the solutions in the [TypeScript Exports error breaks Telerik Blazor]({%slug common-kb-typescript-exports%}) Knowledge Base article.
Expand Down
Loading