Linked Questions
64 questions linked to/from Dynamically load JS inside JS
6377
votes
72
answers
4.5m
views
How do I include a JavaScript file in another JavaScript file?
How do I include a JavaScript file inside another JavaScript file, similar to @import in CSS?
4
votes
1
answer
2k
views
How to reload a script's src [duplicate]
I have a script tag with an src, how can I reload the src with java script code, this is the code I have:
<script src='./script.php'>
<script>
function reload() {
//the code to reload ...
1
vote
0
answers
2k
views
How to execute the <script> tags loaded from the AJAX request in JavaScript? [duplicate]
I know this question has been asked a lot, but everywhere on the internet the answers are like a decade old and everyone was suggesting to use eval which is not a right/secure way to do it.
So, in my ...
0
votes
1
answer
879
views
Is it possible to conditionally loading script tag in JSP based on window variable? [duplicate]
Hi I have to conditionally load a script in one of my jsp files based on a window variable.
Can someone suggest me how can i achieve this. Is it possible ?
Current behaviour :
mytest.jsp file
...
0
votes
0
answers
242
views
Can a different script be loaded in when a button is clicked? [duplicate]
I have two different scripts that do different things but I do not want them to run at the same time as one script displays the video in black and white and another script lets the user add text on ...
153
votes
3
answers
214k
views
Trying to fire the onload event on script tag
I'm trying to load a set of scripts in order, but the onload event isn't firing for me.
var scripts = [
'//cdnjs.cloudflare.com/ajax/libs/less.js/1.3.3/less.min.js',
'//cdnjs....
142
votes
2
answers
135k
views
JQuery to load Javascript file dynamically
I have a very large javascript file I would like to load only if the user clicks on a certain button. I am using jQuery as my framework. Is there a built-in method or plugin that will help me do ...
57
votes
9
answers
117k
views
Clearing Webpack cache
How do you go about forcing webpack to clear its cache?
I'm doing a-lot of work with threejs and webpack and for some reason, unbeknownst to me, it has two copies of threejs in memory. Here's the ...
8
votes
4
answers
20k
views
How to dynamically load and use/call a JavaScript file?
I need to dynamically load a JavaScript file and then access its content.
File test.js
test = function () {
var pub = {}
pub.defult_id = 1;
return pub;
}()
In this case it works:
<!...
20
votes
3
answers
32k
views
Make HTML5 FileReader working with heic files
When reading a file from the input element by the FileReader api it works, but my android device also allows sending files and it seems to send heic files anyway which then results in an empty image ...
12
votes
3
answers
9k
views
dynamically set googleapi key
I have a application wants to embed google map, and it is required that the key is put into a config file. So here is what I do:
In config.js
GOOGLE_MAP_KEY = "mykeyofgoogleapi";
In index.html
<...
7
votes
1
answer
17k
views
Why is script.onload not working in a Chrome userscript?
I want to load another script file, in a site, using a userscript.
But, the js.onload event doesn't work correctly.
The userscript file:
// ==UserScript==
// @name Code highlight
// @...
5
votes
5
answers
7k
views
When does a dynamically loaded JavaScript library become available?
I wrote JavaScript library to use FileSaver.js and its associated libraries. However, I don't want to always load FileSaver.js whenever someone wants to use my library. And I don't want to force them ...
0
votes
2
answers
19k
views
How to load script with jquery.load()?
I have a question.
In my file content.html I have script.
When load this with the load() function of jQuery, the page shows but the script doesn't work. I think it's because of a selector.
How can ...
11
votes
3
answers
3k
views
Update src of script tag using jQuery - reload a script with jQuery without refreshing page
The question says it all. How to update the "src" of script tag using jQuery.
Let say, I have a script,
<script id="somescript" type="text/javascript" src=""></script>
So when I a click ...