Thank you very much for your reply.
In fact, I needed before testing the function, to know what is possible to do.
Using an API is not the same. I’m already using it on thunkable, but for other reasons and it works perfectly.
As I mentioned, the objective will be to use the “post message” method, in the same way that it is used in javascript (https://developer.mozilla.org/en-US/docs/Web/API/Window/postMessage) for example when sending a message to an iframe - is this what we are talking about?
If so, how does it work?
In javascript you can use:
$ (function () {
// Create IE + others compatible event handler
var eventMethod = window.addEventListener? “addEventListener”: “attachEvent”;
var eventer = window [eventMethod];
var messageEvent = eventMethod == “attachEvent”? “onmessage”: “message”;
// Listen to message from child window
eventer (messageEvent, function (e) {
$ (’# div’). html (‘parent received message !:’ + e.data);
}, false);
});
Ideally, this function should be explained and documented in thunkble docs with examples.
Hey @daponto this is a brand new feature i think. I am wanting to learn more about this asap.
for example, i want to be able to pass data to a sheet liek this
I am just learning react.js and basic javascript. (a newbie)
I would think that i should be able to POST my data and then retrieve it with something like
the post body would be an object with parameters like “data”:“1,2,3”
and a short piece of script like this
function doPost(e) { var data = e.parameter.data}
and then somehow that gets passed into the code below (which was copied and pasted directly from google)
@actech do you have any insight into this? I’ve seen you reference passing data to the webvier many times.
What is the intention with the PostMessage functionality, why is it there and what can we do with it?
I also miss other functionalities that are often present for webviews. Like can you notify me when the URL is changed? or even let me know what the URL is?
I know there is a getURL function, but it simply returns the URL I initially provided. If user navigate to another url, the same URL is returned from my webview, that is not nice.
Do not get me wrong, it is nice to have a webview, but we need more and we need examples
I am trying to include payments in the app (i am aware of google policies).
The most known platform is Paypal. So i tried to do include it using 2 different ways:
Web Api → Paypal Api. I don´t get exactly the way of doing it. I didn´t find any tutorial or clear steps to do it. So after obtaining the Oauth2 (first step) i am stocked.
Web Viewer → Paypal Checkout Everything goes well till the moment i have to receive the answer after the transaction. In other words, i don´t get any answer using this method.
Jonathan, Sorry to say, but we have been begging for some input on this for a while, as the function looks interesting - at least it has a great name, but nobody seem to step up and explain what it is for…
I just got it working. This would be the way (Using WebViewer)
In thunkable → When i press the Button3 the webviewer goes to the adress where the html is. And when the purchase is done, it receives the message from html file.
In the html file → I placed the text of the Prueba.txt. Prueba.txt (1.9 KB)
So, the process would be: You click Button3 in Thunkable, the webviewer goes to your web page where you will see paypal buttons, you click on them, you accept (as a buyer) to send the money. Then when everything is completed, you will receive in Thunkable the message with the order info.
I am sure that there are better ways to do it, but at least this seems to be working.
Jared, that is a bit harsh - a few lines of text on how to setup the communication is a fair level of documentation imho. Your 14 lines would suffice for most.
Sorry for the delay in adding these details to the Web Viewer docs.
The docs have been updated, giving a general overview of what the Post Message/Receives Message blocks do.
They point to the GitHub for greater detail about how to implement this, since at that point you’re getting into web development so it makes sense to point to an external resource.
I hope that you are using Axios as a network request library. Axios is promise-based, which gives you the ability to take advantage of JavaScript’s async and await for more readable asynchronous code.
I don’t know what is your response when the promise is resolved. Is it an error or plain HTML?