Insert JS file from local repository #3135
-
I'm using the source value to add HTML. So, my question Is it possible to pass a JS file from my base code to the source in the view? Like I have this code in my repository <!DOCTYPE html>
<html>
<head>
<script defer="defer" src="./path/to/my/file.js"></script>
</head>
<body>
<div id="root"></div>
</body>
</html> I'm try to do it, but looks like it's not possible. Also, I tried to add a build ReactJS project as inline JS. But looks like the browser fails with this line (with the tags):
|
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
I was able to do it with inline. I just do the same example here. I paste the value from This is the file <!doctype html>
<html lang="en">
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width,initial-scale=1" />
<script>
window.addEventListener('load', function() {
// 👉 Paste the content from `./path/to/my/file.js` here 👈
});
</script>
</head>
<body>
<div id="root"></div>
</body>
</html> And I call the WebView here: const localHtmlFile = require('./test.html');
<WebView source={localHtmlFile} /> It works 🎉 !!!!!!!!!! |
Beta Was this translation helpful? Give feedback.
I was able to do it with inline. I just do the same example here. I paste the value from
./path/to/my/file.js
in a HTML file:This is the file
test.html
And I call the WebView here:
It works 🎉 !!!!!!!!!!