PageSource source files not found on browser load

Hi guys,

I setup a PageSource object with a Shown event and set the behavior Before Content and the source is doing a basic load of some js libraries that I have included in the same working folder as the Xojo project that I’m running. My browser shows, "Failed to load resource: the server responded with a status of 404 (OK) "

Where do I need to put these files to reference them.

For example:

/home/jremi/code/xojoproject1 (inside here i have the actual xojo project file)
/home/jremi/code/xojoproject1/specialJSlibrary/myspeciallibrary.js

I have set the source parameter on the PageSource object to “/specialJSlibrary/myspeciallibrary.js”

How do I make this correctly load in the browser? The browser is showing the path to load as "http://127.0.0.1:8080/specialJSlibrary/myspeciallibrary.js

Thanks

I have also added the entire specialJSlibrary folder directly into the Xojo Project Explorer on the left side of IDE. Still no luck :frowning:

Well guys, I may have fixed the issue. I had to push the files to a remote server and not have them running locally. I would have thought I could have done this with the files local.

You can. But you have to phrase the request from the client browser’s perspective and use a real URL, not a local path.

@Tim Hare I’m not sure what else i’m missing here…

I have the PageSource loading the css file I can see it showing inside the browser but the js script is not triggering. I don’t see it showing loaded in browser. Only showing the default framework.js that xojo loads for the web app.

PageSource1
Source is set for:

On a button I have action event …
Me.ExecuteJavaScript(“alertify.alert(‘Database created!’);”)

Still cant get the javascript to fire…

I don’t think xojo is loading the alertify.js because I can’t see it loaded in Resources when reviewing page loads inside Chrome browser developer tools.

Any ideas?

I’m attempting to fire the JS via global method from outside the PageSource controller. I think this should be ok?

If it loads from a remote site, but not locally, that means you don’t have the correct url for the local copy. Your url doesn’t line up with the folder structure you gave earlier. What is the url you use to access xojoproject1? That should be the base of the url for the scripts.

As of now…

I have Xojo IDE running with a project file that is located in /home/jremi/xojoproject1

I uploaded the js+css files to a remote server.

I am able to load the css but the js file is not loading.

Let me know if that helps clarify.

The only thing that is local now is the actual Xojo project file that I’m using to debug with. I have the PageSource pulling the script from remote and the css from remote. It is able to load css no problem, but the actual js file is not loading into browser.

Anyway, at this point no idea whats going on.

All third-party remote JS that I attempt to load via the Source parameter on PageSource object never load. The remote links are valid. But no success. Not sure what else is necessary to make the JS files load into the Xojo web app.

If anyone here has an example of how to load remote JS libraries into a Xojo web app , please let me know. I can never make the JS load into the web app. I know the PageSource source property is set and triggering because the remote css file is loading into the web app.

Sorry for so many posts, I’m just smacking my head against the wall and can’t seem to understand what I’m missing here.

Thanks for any help :slight_smile:

You need to load the js library in the session.preparesession event, parse in htmlheader propertie.