Xcode Not Loading Javascript?
Posted: Wed Aug 16, 2017 10:29 pm
I want to start by apologizing for asking so many questions recently. This is my first time uploading an app to the App Store and it has been quite tedious.
Anyways, for some reason, Xcode will not load my javascript files. My file setup under Samples is similar to this:
main.txt
lib
-> index.html
-> index.js
-> index.css
My main.txt file is:
I have my phone hooked up to my Mac and I am running the app on my iPhone. The first time I ran it, everything worked fine. I fixed a few typos, ran the code again, and now it is like my "index.js" file is not loading. The html loads up, the css styling works, but none of the javascript is working. I put an alert("test") at the top of my javascript file and it did not work.
However, when I put <script>alert("hi");</script> in my HTML file, it does work.
So, if I type the javascript into my HTML using <script> tags, it works. But for some reason, I cannot load external JS files.
Also, I need to mention, if I run my index.html file in a Browser such as Safari or Google Chrome, everything works fine. It is only when I try to run the code on Xcode that it does not work.
Anyways, for some reason, Xcode will not load my javascript files. My file setup under Samples is similar to this:
main.txt
lib
-> index.html
-> index.js
-> index.css
My main.txt file is:
Code: Select all
SET ORIENTATION PORTRAIT
SET TOOLBAR OFF
GET SCREEN SIZE maxx,maxy
BROWSER "main" URL "lib/index.html" AT 0,0 SIZE maxx,maxy
menu:
SLOWDOWN
goto menu
I have my phone hooked up to my Mac and I am running the app on my iPhone. The first time I ran it, everything worked fine. I fixed a few typos, ran the code again, and now it is like my "index.js" file is not loading. The html loads up, the css styling works, but none of the javascript is working. I put an alert("test") at the top of my javascript file and it did not work.
However, when I put <script>alert("hi");</script> in my HTML file, it does work.
So, if I type the javascript into my HTML using <script> tags, it works. But for some reason, I cannot load external JS files.
Also, I need to mention, if I run my index.html file in a Browser such as Safari or Google Chrome, everything works fine. It is only when I try to run the code on Xcode that it does not work.