Jump to content
View in the app

A better way to browse. Learn more.

Invision Community

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.
Support Availability Notice

PHP to JS app port using Pages

Featured Replies

Hi

I have a few javascript apps in Pages. It's been a while. In prep for moving to v5 of the forums, I have an old app I am moving to JS and I've run into a problem I haven't encountered on invision before. I am using the latest version 4. I get these errors:

GET [domain]/tools/v1-3/music-theory-tool/JS/theory.js net::ERR_ABORTED 404 (Not Found)

music-theory-tool/:1 Refused to execute script from '[domain]/tools/v1-3/music-theory-tool/JS/theory.js' because its MIME type ('text/html') is not executable, and strict MIME type checking is enabled.

music-theory-tool/:1237 GET [domain]/tools/v1-3/music-theory-tool/JS/app.js net::ERR_ABORTED 404 (Not Found)

music-theory-tool/:1 Refused to execute script from '[domain]/tools/v1-3/music-theory-tool/JS/app.js' because its MIME type ('text/html') is not executable, and strict MIME type checking is enabled.

app.js.0cea16b802fb6034394847f42ac1ecca.js:1 Uncaught ReferenceError: MusicTheory is not defined

(anonymous) @ app.js.0cea16b802fb6034394847f42ac1ecca.js🥇

I added these files as templates.

Any ideas on how to fix this? The files are included on the page. Within the files are very simple classes. In fact, right now they are reduced to a log message.

Cheers

John

Edited by Songstuff

Are you including these Javascript files via Pages or are you adding them custom? A 404 error would be not found, meaning the Javascript is not at the URL you're using.

  • Author
17 hours ago, Jim M said:

Are you including these Javascript files via Pages or are you adding them custom? A 404 error would be not found, meaning the Javascript is not at the URL you're using.

They are included using the checkbox on the “page includes” in admin.

  • Author

I think there are two things going on:

I did have a load in the html, so the load was happening two ways. I have now removed those.

It has highlighted another issue, that could be to do with load order. Are JavaScript files in Pages loaded in alphabetical order?

My App is loaded in app.js, the Music theory class in theory.js. The app is trying to instantiate the music theory class before the file is loaded, and so doesn’t recognise it. When I tested it outside of invision, (pure html and JS) I controlled the load order.

You can click the view source of the page and see the order which the Javascript is loaded on the page.

  • Author

Is there a way to dictate the JS file load order? As far as I can see, it's a simple file selection, and then it comes down to the alphabetical order of the file names.

  • Author
23 hours ago, Marc said:

There isnt a way in which to dictate the order I believe

A bit of a pain, but good to know. Thanks, Marc.

Recently Browsing 0

  • No registered users viewing this page.

Account

Navigation

Search

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.