HTML5 can't load XML file on the same folder

Bringing your stacks to the web

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller

Post Reply
mikelpapamike
Posts: 32
Joined: Sat Feb 27, 2021 12:17 am

HTML5 can't load XML file on the same folder

Post by mikelpapamike »

Hello,

I deployed an app that loads an XML file and displays its data. On windows standalone works great. But when I save standalone as HTML5, put url command does not work. Is there a way that I can read a file on my HTML5 standalone?

I deployed it on my webserver under www mydomain . com / myapp and also uploaded my xml file on the same folder.
jacque
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 7423
Joined: Sat Apr 08, 2006 8:31 pm
Contact:

Re: HTML5 can't load XML file on the same folder

Post by jacque »

Do you get an error in the result? I'm thinking the path may be wrong, what url do you use?
Jacqueline Landman Gay | jacque at hyperactivesw dot com
HyperActive Software | http://www.hyperactivesw.com
mikelpapamike
Posts: 32
Joined: Sat Feb 27, 2021 12:17 am

Re: HTML5 can't load XML file on the same folder

Post by mikelpapamike »

Hello Jacque,

Yes I do get an error ""Failed to read preferences file at location" which means it can not find the file from the url i specified, inside the IDE when i try to load the file from : https://www.mydomain.som/file.xml it works normally but not when deploying to Html5.

Inside the stack I do have a button that saves a .txt file from a field to the "the effective filename of this stack" and load it back with another button that both work.

Any idea how to properly give the correct url of the xml file on my hosting server for the stack to be able to find and load it?

Thanks in advance.
mikelpapamike
Posts: 32
Joined: Sat Feb 27, 2021 12:17 am

Re: HTML5 can't load XML file on the same folder

Post by mikelpapamike »

I now tried to find the path that the program runs from, but the effective filename of this tsack, returns "./this.program" which i have no idea what means :cry:
jacque
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 7423
Joined: Sat Apr 08, 2006 8:31 pm
Contact:

Re: HTML5 can't load XML file on the same folder

Post by jacque »

I'm just guessing, but the path you got for the effective filename of the stack indicates a relative path that points to the folder the stack is in. The "./" means the current folder. You might want to try simply "./file.xml" and see if that works.
Jacqueline Landman Gay | jacque at hyperactivesw dot com
HyperActive Software | http://www.hyperactivesw.com
mikelpapamike
Posts: 32
Joined: Sat Feb 27, 2021 12:17 am

Re: HTML5 can't load XML file on the same folder

Post by mikelpapamike »

I already tried this with No luck.
AndyP
Posts: 634
Joined: Wed Aug 27, 2008 12:57 pm
Contact:

Re: HTML5 can't load XML file on the same folder

Post by AndyP »

If you have a lc server, you can use this to get the server path.

Code: Select all

<?lc

put $_Server["PATH_TRANSLATED"]

?>
if you name the file serverpath.lc , launch serverpath.lc in the browser, you will see a result that gives the full server path to the serverpath.lc file


or try this for php

Code: Select all

<?php 
    echo realpath('path.php'); 
?>
Andy .... LC CLASSIC ROCKS!
Post Reply