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 » Mon Dec 12, 2022 11:06 pm

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: 7210
Joined: Sat Apr 08, 2006 8:31 pm
Location: Minneapolis MN
Contact:

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

Post by jacque » Tue Dec 13, 2022 8:21 pm

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 » Tue Dec 13, 2022 11:21 pm

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 » Tue Dec 13, 2022 11:48 pm

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: 7210
Joined: Sat Apr 08, 2006 8:31 pm
Location: Minneapolis MN
Contact:

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

Post by jacque » Fri Dec 16, 2022 11:03 pm

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 » Fri Jan 27, 2023 7:02 pm

I already tried this with No luck.

AndyP
Posts: 614
Joined: Wed Aug 27, 2008 12:57 pm
Location: Seeheim, Germany (ex UK)
Contact:

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

Post by AndyP » Sat Jan 28, 2023 3:28 pm

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 Piddock
https://livecode1001.blogspot.com Built with LiveCode
https://github.com/AndyPiddock/TinyIDE Mini IDE alternative
https://github.com/AndyPiddock/Seth Editor color theming
http://livecodeshare.runrev.com/stack/897/ LiveCode-Multi-Search

Post Reply

Return to “HTML5”