Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
How to set cookie information for a page?
#2
(2022-09-21, 03:40:41)Leeson Wrote: Hello, I have a few questions here hoping to get a response, thanks!
1. I read the documentation and can't find a way to set cookies, how can I set cookies?
2. How do I get DOM events, such as a button click event?
3. Is there a better way to call JavaScript functions synchronously?
4. OnWebMessageReceived was unable to receive messages in PowerBuilder 9.0, OS: WINDOWS 11。

Hi,

Thank you for your questions.

1. Currently the only way to set cookies is via Javascript. The cookiemanager isn't yet exposed, but I will look into that.

2. For catching DOM events you will have to inject javascript into the current page, for example using addEventListener.
Then in that event use postmessage to notify that back to the host application. A technique that leads us back to your question 4)

3. Not sure what you tried. There is RunAnonymousFunctionSync if you want to run javascript synchronously, but it has some limitations, like not being able to run that from AntView events.
The problem here is that all of the WebView2 control is designed by Microsoft to be used asynchronously.
Adding a synchronous layer on top of that has its problems. This is something that will be expanded upon to make it easier to use and work around some of the limitations.

4. I don't have PowerBuilder 9 here to test with. Only tested against the most recent version of PowerBuilder at the time (PB 2021 from the looks of it)
Have you tried the WebMessage example ? Is OnWebMessageReceived not working in that example either?

Can you even run the examples in PowerBuilder 9?

--
Wil
Reply


Messages In This Thread
RE: How to set cookie information for a page? - by wila - 2022-09-21, 09:43:36

Forum Jump:


Users browsing this thread: 1 Guest(s)