Add local javascript script to html
See original GitHub issueHey, sorry if this is not the right place to ask.
I’m using PuppeteerSharp in an ASP.NET core
project to generate reports. I basically generate all the html document using handlebars
and then inject the whole html using SetContentAsync
.
I have a local javascript library bundle (Chartjs.bundle.min
) and I am not able to figure out which path I should use to make chromium see it.
I tried an absolute path, I also tried to put the library file in the same folder as chromium and reference it using ./Chartjs.bundle.js
but it doesn’t seem to work.
What is the correct way to handle that.
Issue Analytics
- State:
- Created 4 years ago
- Comments:5 (3 by maintainers)
Top Results From Across the Web
Including JavaScript In Your Page
Here's a very basic snippet of JavaScript using the script tag. This JavaScript is written directly into our HTML page. It will call...
Read more >HTML script src Attribute
The src attribute specifies the URL of an external script file. If you want to run the same JavaScript on several pages in...
Read more >What is the right way to write my script 'src' url for a local ...
This goes to the current working directory (location of index.html) and then to the js folder, and then finds the script.
Read more >How to add a JavaScript file in HTML?
To add a JavaScript file in HTML provide your JavaScript file path to the src attribute of the <script> tag or if you...
Read more >An Essential Guide on How to Add JavaScript to HTML - Linode
Wondering how to link javascript to HTML? Follow our step-by-step instructions, including examples, plus tips on how to add external ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@psclkhoury you will need to register the js using the file protocol. It must be an absolute path but using that “path style”.
@psclkhoury after some reading I found that’s a security validation in Chrome. You don’t a site try to read a file from your file system.
I like your solution, you could also host that file in some server and access it using a normal url.