Using javascript from a website template in WASM

Wout Ongena 21 Reputation points
2021-07-26T11:31:55.107+00:00

I want to use a website template for my Blazor webassembly project.

it has a few nice features like a JavaScript carousel and I would like to use those but I dont know where to put the JavaScript links to the files. I have tried putting them in the index.html file in the wwwroot folder but that did not seem to work:

117829-image.png

Do I need to use another way of adding this JavaScript or should I add them somewhere else?

Blazor
Blazor
A free and open-source web framework that enables developers to create web apps using C# and HTML being developed by Microsoft.
1,396 questions
0 comments No comments
{count} votes

Accepted answer
  1. JasonPan - MSFT 4,366 Reputation points Microsoft Vendor
    2021-07-27T07:06:47.9+00:00

    Hi @Wout Ongena

    According to your description, I created a sample project and added bootstrap image carousel function. It works fine.

    So add the reference of the js file in your way is correct. Now you can follow my steps to solve the issue.

    TroubleShooting Steps:

    Press F12, make sure all js file you have loaded when open index.html page.

    1. You can check Console.

    118118-image.png

    2. You can check Source.

    118173-image.png

    3. You also can check Network.

    118127-image.png

    My test code and result :

    118166-image.png

    118128-image.png

    118136-3.gif


    If the answer is helpful, please click "Accept Answer" and upvote it.
    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.

    Best Regards,
    Jason


0 additional answers

Sort by: Most helpful