Why is POST to URL not working in html5 standalone?

Bringing your stacks to the web

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller

Post Reply
adventuresofgreg
Posts: 349
Joined: Tue Oct 28, 2008 1:23 am
Contact:

Why is POST to URL not working in html5 standalone?

Post by adventuresofgreg » Wed Jun 23, 2021 5:03 pm

my POST url command works in every kind of standalone except for html5. ???

I include the "internet" library as "inclusions" when building.

put "action=login&email=" & URLencode(LoginEmail) & "&pw=" & URLencode(LoginPass) into PostData
post PostData to URL "https://myURL.com/users-data/php/webservice_eg.php"
put "result:" && it into field "tester"

I have also tried converting to a GET command and that also does not work. I am testing using development/test menu command in LC... perhaps this only works if being served by an actual server??

Thanks,
Greg

adventuresofgreg
Posts: 349
Joined: Tue Oct 28, 2008 1:23 am
Contact:

Re: Why is POST to URL not working in html5 standalone?

Post by adventuresofgreg » Wed Jun 23, 2021 6:56 pm

more info: my server is getting a post command from my html5 app, but it is EMPTY. I have tried to simplify the POST command bypassing any variables, and still, nothing is sent. Again, all of these commands work fine when sent from LC directly, or from a standalone including an iOS app. Just nothing happens when sending POST from html5 app.

adventuresofgreg
Posts: 349
Joined: Tue Oct 28, 2008 1:23 am
Contact:

Re: Why is POST to URL not working in html5 standalone?

Post by adventuresofgreg » Wed Jun 23, 2021 7:03 pm

more info: I just tried putting url "https://www.google.com" into a field and that also wont work, so there is something very basic going wrong. I've checked, and I am including the "internet" library as an inclusion. Is there some other library that is required?

adventuresofgreg
Posts: 349
Joined: Tue Oct 28, 2008 1:23 am
Contact:

Re: Why is POST to URL not working in html5 standalone?

Post by adventuresofgreg » Wed Jun 23, 2021 7:39 pm

more info: I'm posting these details as I go along here because maybe this can help others with similar issues.

I am hosting my html 5 app on "myserver.com"

This works: put URL "https://www.myserver.com" into field "afield"

But this does NOT work: put URL "https://www.google.com" into field "afield"

Seems like the content of the URL must reside on the same domain as the html 5 app is being hosted on. Is this correct?

However, I'm still not able to get a POST command to work...

MarBor
Posts: 15
Joined: Fri Sep 18, 2020 2:56 pm

Re: Why is POST to URL not working in html5 standalone?

Post by MarBor » Fri Jun 25, 2021 1:01 pm

Hi adventuresofgreg,

I had the same problem with the POST command not working with HTML5 standalones.

I reported a workaround that works for me in another thread:

viewtopic.php?f=120&t=34730&p=197208#p197208

It is basically about using the javascript enverinmont the HTML5 app is running in (as far as iI understand).
You insert a javascript post command and run it in your LiveCode app via the do function (https://livecode.fandom.com/wiki/Do), which allows you to execute some javascript code in your App.

So far, this works fine for me.

Hope it helps!

Best,

Martin

adventuresofgreg
Posts: 349
Joined: Tue Oct 28, 2008 1:23 am
Contact:

Re: Why is POST to URL not working in html5 standalone?

Post by adventuresofgreg » Fri Jun 25, 2021 2:10 pm

Latest: We did get GET to work, but GET is not secure. POST does not work. Finally LiveCode admitted that POST does not work in html5:

LiveCode:
I checked with tech, and I'm told the dictionary entry is wrong. POST does not work in HTML5 because it requires "wait" which cannot be implemented in the current version of HTML5. It is something we are looking at for a future release.

I have raised a bug report so that we correct the dictionary entry.

MarBor
Posts: 15
Joined: Fri Sep 18, 2020 2:56 pm

Re: Why is POST to URL not working in html5 standalone?

Post by MarBor » Fri Jun 25, 2021 2:16 pm

The workaround uses the post command via javascript (not via LC) and works.
I don't know how to implement a feedback on the success of the posting process, though.

TorstenHolmer
Posts: 57
Joined: Mon Oct 28, 2013 1:23 pm
Location: Dresden, Germany

Re: Why is POST to URL not working in html5 standalone?

Post by TorstenHolmer » Mon Jun 05, 2023 8:44 am

I have implemented a HTML5 standalone and it can communicate directly with the server where the standalone is installed with the normal GET (put url URL into VAR) and POST (post VAR to url URL).

This does not work if the URL is not on the same server than the standalone.

Then the javascript trick from MarBor https://forums.livecode.com/viewtopic.p ... 08#p197208 seems to be better, but there is the challenge to get the response data. It seems to work if the javascript is done by the browser widget, which can have a callback-interface via javascript handlers.

Post Reply

Return to “HTML5”