Currently, I find myself in a situation where I am required to utilize classes from JavaScript across various js files. For instance, there is a class named Panel
located within the file js/radar-home.js
. Below is how I am currently utilizing the class within my HTML file:
<script src="{{ asset('js/radar-home.js') }}"></script>
<script>
try{
var panel1 = new Panel(args);
catch(err){
alert("Internal Error - " + err);
}
</script>
This approach functions flawlessly on Windows and Android devices, as well as all the browsers I have tested, including Chrome. However, when attempting to load this on Safari, Chrome, Firefox, or the WebDebug app on my iPhone or iPad, an alert pops up with the message:
Internal Error - RefrenceError: Can't find variable: Panel
.
Environment details:
- PHP 7.3.21
- Laravel 6.18.25
- Hosted on an Ubuntu 20.04 server
- The source code seems identical on both iOS and Windows browsers.
- CloudFlare (proxied) - Even before setting this up, the exact same issue persisted, even when not using HTTPS.
Your assistance would be greatly appreciated.
EDIT:
I have added a function within radar-home.js
that is not encapsulated within a class. This function executes without errors on desktop platforms but encounters issues on IOS. The error output states:
RefrenceError Can't find variable: testing123
(testing123()
was the test function created).