'C# WebBrowser not loading local Javascript file

I am using the C# WebBrowser control. My HTML renders fine. However, I need to keep external files on the local computer. References to the local copy of files do not work.

How do I write the HTML to load locally stored files?

This works:

<script type='text/javascript' src='https://code.jquery.com/jquery-latest.min.js'></script>

This works when loading a file directly in to a browser, but not through the C# WebBrowser control:

<script type='text/javascript' src='./jquery-latest.min.js'></script>

Adding the full path gets rid of error messages, but still does not work.

<script type='text/javascript' src='file:///C:/<full path>/jquery-latest.min.js'></script>

I have tried adding this to the first line of the html file which does not solve the problem.

<!-- saved from url=(0014)about:internet -->


Solution 1:[1]

Just put your local js file in the same directory with your html file. Then use this will do

<script type='text/javascript' src='./jquery-latest.min.js'></script>

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 DamnScandalous