How to load a text file on same domain?

Bringing your stacks to the web

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller

Post Reply
tomBTG
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 73
Joined: Fri Nov 25, 2011 6:42 pm
Location: Kansas City

How to load a text file on same domain?

Post by tomBTG » Sun Feb 25, 2018 8:04 pm

Hi Livecoders.

I need an HTML5 app to load a text file of questions from the same domain that hosts the app. I read in this forum that "get url" methods are not supported yet in HTML5.

Is there an alternative to "url" to load a simple text file?

Thanks,
Tom B.

FourthWorld
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 9801
Joined: Sat Apr 08, 2006 7:05 am
Location: Los Angeles
Contact:

Re: How to load a text file on same domain?

Post by FourthWorld » Sun Feb 25, 2018 10:24 pm

Double check GET in recent versions. I think that was added not long ago.
Richard Gaskin
LiveCode development, training, and consulting services: Fourth World Systems
LiveCode Group on Facebook
LiveCode Group on LinkedIn

tomBTG
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 73
Joined: Fri Nov 25, 2011 6:42 pm
Location: Kansas City

Re: How to load a text file on same domain?

Post by tomBTG » Mon Feb 26, 2018 12:46 am

Right you are, Richard. That was in 9.0.0-dp11.

For others interested in this, it now works to use

Code: Select all

Load URL "https://www.mysite.com/myfile.txt" with message "callBackHandler"
Then load the file data with...

Code: Select all

on callBackHandler pURL, pStatus
   if pStatus is "cached" then
      put URL pURL into myVar
   else if pStatus is "error" then
      put libURLErrorData(pURL) into field "error"     
   end if
end callBackHandler
Thanks,
Tom

[-hh]
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 2262
Joined: Thu Feb 28, 2013 11:52 pm
Location: Göttingen, DE

Re: How to load a text file on same domain?

Post by [-hh] » Mon Feb 26, 2018 1:10 am

You are not forced to use (the buggy) 9.0.0-dp11, load URL works since 9.0.0-dp7.
Here is a test with images
http://forums.livecode.com/viewtopic.ph ... 58#p154958
shiftLock happens

tomBTG
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 73
Joined: Fri Nov 25, 2011 6:42 pm
Location: Kansas City

Re: How to load a text file on same domain?

Post by tomBTG » Mon Feb 26, 2018 4:23 pm

Thanks for that point, Hermann. I'll rollback to 9.0.0-dp7.

Tom Bodine

FourthWorld
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 9801
Joined: Sat Apr 08, 2006 7:05 am
Location: Los Angeles
Contact:

Re: How to load a text file on same domain?

Post by FourthWorld » Mon Feb 26, 2018 5:14 pm

No version of v9 has reached Stable. All builds of that version so far have been Developer Preview builds, made available to developers to evaluate how well the new version works with the particular set of features their projects need, providing an opportunity to submit bug reports so the final version can have those resolved.

From time to time some builds may be better for some projects than others, but as a general rule all later builds incorporate bug fixes from all work to date.

Hermann has good judgment, and if he feels dp7 is better for HTML export than dp11, I would defer to his experience.

But using older versions will mean other fixes addressed since that build was released will not be present, so if you submit a bug report against anything other than the most recent build, please take a moment to search the bug DB first to see if it hasn't already been addressed.
Richard Gaskin
LiveCode development, training, and consulting services: Fourth World Systems
LiveCode Group on Facebook
LiveCode Group on LinkedIn

[-hh]
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 2262
Joined: Thu Feb 28, 2013 11:52 pm
Location: Göttingen, DE

Re: How to load a text file on same domain?

Post by [-hh] » Mon Feb 26, 2018 6:23 pm

Regarding HTML5 deployment, AFAIK, 900-dp7 to dp10 are essentially the same.
LC 900-dp11 has a 'preview' of great new approaches but was forced (also by the loud wishes of the community) to appear before Christmas. It is a typical made-in-a-hurry product.
shiftLock happens

FourthWorld
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 9801
Joined: Sat Apr 08, 2006 7:05 am
Location: Los Angeles
Contact:

Re: How to load a text file on same domain?

Post by FourthWorld » Mon Feb 26, 2018 7:55 pm

I recall folks being pleased to see LC Ltd's announcement of dp11, but I'm not so sure the timing of the release was in response to popular demand as I recall many being surprised as they were delighted.

Either way, some builds will be better than others, and while I've found the other fixes from the v8.x series folded into v9dp11 very welcome, I haven't run an HTML export from it.

Can you outline some of the key issues introduced in dp11? Do you know the corresponding bug IDs for those so we can follow their progress?
Richard Gaskin
LiveCode development, training, and consulting services: Fourth World Systems
LiveCode Group on Facebook
LiveCode Group on LinkedIn

[-hh]
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 2262
Joined: Thu Feb 28, 2013 11:52 pm
Location: Göttingen, DE

Re: How to load a text file on same domain?

Post by [-hh] » Mon Feb 26, 2018 9:22 pm

I tried 900-dp11 a full day (10 hours).

In general, if there are new features/bug removals I test that "isolated". If it works, I try more. If not, I'll stop. No need to report that -- the developer knows what's going on when using it isolated.
For example the "new-window" feature with HTML5 is pre-alpha: No layering possible, the main window doesn't receive focus any more. Not even window dragging is possible (wrong coodinates are reported). I know this is not simple and I look forward to that if it works.

When a new LC-version appears I test HTML5 deployment with several "complicated" (beyond 'hello world'-state) stacks which run well in earlier versions. When they all still go well, I go on with that version. If not I'll stop, as with 900-dp11.
HTML5 developing is time consuming, I can't spend a weak for bring all that no-longer-working down to a bug report. Especially if there is no documentation about changes but new features (which are not used with the old stacks).

LCB is a similar point, the new undocumented 'features' made me stop to use LC 9 for widget development. There may be less hurdles with new versions if you develop for Mac only but I have the cross-platform-goal.

LC 900-dp11 is the first LC 9 version I refuse to use. With all others before I started the day after to report bugs from my testings. But dp11 knocked me out on that first day, one strong hook from LCB and one from HTML5, has effects on me until today.
shiftLock happens

[-hh]
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 2262
Joined: Thu Feb 28, 2013 11:52 pm
Location: Göttingen, DE

Re: How to load a text file on same domain?

Post by [-hh] » Wed Apr 17, 2019 10:56 am

This has nothing to do with the LC HTML5 standalone builder.

But you can do it in JavaScript using fetch
( see for example https://developer.mozilla.org/en-US/doc ... /Fetch_API ).

If the file is on the same domain or if you would like to insert a time stamp only then you could also use SSI ( https://en.wikipedia.org/wiki/Server_Side_Includes ).
shiftLock happens

Post Reply

Return to “HTML5”