# Javascript loaded from wrong location

**URL:** <https://forum.radzen.com/t/javascript-loaded-from-wrong-location/21703>\
**Category:** Radzen Blazor Studio\
**Created:** [September 14, 2026, 11:27am UTC](https://forum.radzen.com/t/javascript-loaded-from-wrong-location/21703 "2026-09-14T11:27:06Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![weismantelf](https://forum.radzen.com/letter_avatar_proxy/v4/letter/w/9dc877/32.png) [@weismantelf](https://forum.radzen.com/u/weismantelf)\
**Post date:** [September 14, 2026, 11:27am UTC](https://forum.radzen.com/t/javascript-loaded-from-wrong-location/21703/1 "2026-09-14T11:27:06Z")

</div>

The following problem occurs only in the designer.

I am using a blazor component which is using javascript.  
When I am placing the component on a page, I get a rendering error:

Failed to fetch dynamically imported module : file:///C:/js/myScript.js

So instead using the path relative to the project, it is interpreting the  
url of the script absolute to the file system.

---

<div class="post-metadata">

**Author:** ![korchev](https://forum.radzen.com/user_avatar/forum.radzen.com/korchev/32/4_2.png) [@korchev](https://forum.radzen.com/u/korchev)\
**Post date:** [September 14, 2026, 2:06pm UTC](https://forum.radzen.com/t/javascript-loaded-from-wrong-location/21703/2 "2026-09-14T14:06:56Z")

</div>

How does the component include the JS file? Please paste the code here.

---

<div class="post-metadata">

**Author:** ![weismantelf](https://forum.radzen.com/letter_avatar_proxy/v4/letter/w/9dc877/32.png) [@weismantelf](https://forum.radzen.com/u/weismantelf)\
**Post date:** [September 14, 2026, 5:48pm UTC](https://forum.radzen.com/t/javascript-loaded-from-wrong-location/21703/3 "2026-09-14T17:48:20Z")

</div>

```auto
 protected override async Task OnAfterRenderAsync(bool firstRender)

    {

        if (!firstRender)

        {

            return;

        }

        _module = await JSRuntime.InvokeAsync<IJSObjectReference>("import", "/js/myScript.js");

        _connected = await _module.InvokeAsync<bool>("connect", _lineId, FromElementId, ToElementId, ToLeftMiddle ? "left" : "center", Straight);

    }

```

---

<div class="post-metadata">

**Author:** ![weismantelf](https://forum.radzen.com/letter_avatar_proxy/v4/letter/w/9dc877/32.png) [@weismantelf](https://forum.radzen.com/u/weismantelf)\
**Post date:** [September 14, 2026, 5:50pm UTC](https://forum.radzen.com/t/javascript-loaded-from-wrong-location/21703/4 "2026-09-14T17:50:40Z")

</div>

I found the problem. For the designer it must be:

```auto
_module = await JSRuntime.InvokeAsync<IJSObjectReference>("import", "./js/myScript.js");

```

---

<div class="post-metadata">

**Author:** ![korchev](https://forum.radzen.com/user_avatar/forum.radzen.com/korchev/32/4_2.png) [@korchev](https://forum.radzen.com/u/korchev)\
**Post date:** [September 14, 2026, 6:42pm UTC](https://forum.radzen.com/t/javascript-loaded-from-wrong-location/21703/5 "2026-09-14T18:42:44Z")

</div>

Hi @weismantelf,

Thanks for the details! This is an issue in the Radzen Blazor Studio designer - it only resolves module paths that start with "./" relative to the application. We will fix it so paths starting with "/" work as well. Until then "./js/myScript.js" is the right workaround and works both in the designer and at runtime.
