OnPermissionRequested from Powerbuilder - Printable Version +- Antwise community forums (https://forums.antwise.com) +-- Forum: Antview (https://forums.antwise.com/forumdisplay.php?fid=11) +--- Forum: Antview for Windows (https://forums.antwise.com/forumdisplay.php?fid=12) +--- Thread: OnPermissionRequested from Powerbuilder (/showthread.php?tid=118) |
OnPermissionRequested from Powerbuilder - DavidS - 2022-06-09 I've been happily using AntView version 1.0.111-2 with Powerbuilder for a project and it's been working absolutely perfectly. I recently tried using it for a second project which accesses a different website. Everything worked fine, except I kept getting messageboxes pop up from the website requesting permission to access generic sensors. It didn't matter whether I clicked allow or deny, once I'd got rid of the messagebox, everything worked fine and the website functioned as normal. However, I wanted to automate the process, so I needed a way to automatically deal with these permission requests. I noticed the newer version 1.1.174 of AntView has a new event OnPermissionRequested, which I thought I could use to trap and handle these events, so I installed the newer version. Unfortunately, this event doesn't appear to fire. On accessing the website, instead of getting any permission messageboxes at all, the website seems to sort of hang. Although some basic functionality on the website works, none of the links work and any further navigate commands don't work. Going back to basics, I tried accessing the website from the example Web Browser Demo application, with the same result - you can access the website, but then none of the links work and you can't navigate to another web page. The website is https://www.ft.com Is there something stupid I'm doing wrong? Is there perhaps a flag to enable the OnPermissionRequested event that I have to set? Any assistance would be greatly appreciated. Many thanks, David RE: OnPermissionRequested from Powerbuilder - wila - 2022-06-09 Hello David, When I tried to visit the https://www.ft.com site from down here, it did not trigger any permission related popups for me. Might be that that is region specific. However I just looked in my list of open support issues and there is a known support issue around permission requests. The State variable returns invalid data and unless you set that to something valid (such as 1) it will block ongoing navigational requests. I will look at that today to see if I can figure out what is happening here. FWIW, one could see this with a site such as https://www.weerplaza.nl (search "Zoek voor Plaats of Postcode" gives an option to use GPS) re. the event not firing. I'm not sure why you are seeing that. It certainly does fire here. One thing I noticed with PowerBuilder that you have to remove the control and add it fresh in order for it to see new events. For details see: https://docs.appeon.com/pb2019r3/application_techniques/ch05s03.html and in particular this bit: Quote:Using events of the ActiveX control More details later once I had a chance to debug this for a bit and see what is happening. -- Wil RE: OnPermissionRequested from Powerbuilder - DavidS - 2022-06-09 Very many thanks for the quick reply, Wil. I tried again using https://www.weerplaza.nl with the web browser demo and I get similar results. The website loads up fine and at first I can click on links as normal. But as soon as I go to the "Zoek voor Plaats of Postcode" box and click on the "Bepaal met GPS" link, the same thing happens. Links no longer work and typing a new URL into the address bar and clicking "Go" does nothing. I'd already uninstalled and reinstalled the ActiveX object to get the new events. Within the event, I've tried some code to display the received parameters, a line of code to just beep when the event is fired, and also the simplest possible code to try to return a valid result (ie just "state = 0" and "state = 1"). Nothing seems to change the behaviour of the application. If I set a breakpoint within the code on that line, it doesn't get hit. Incidentally, I've tried this on two separate machines, one running the latest version of Powerbuilder (Version 2021, build 1506) and one running a slightly earlier version (Version 2019 R2, build 2353). Both display the same behaviour. I've also tried building the application into an executable, in case it was something to do with running in the development environment, but that made no difference. Hope this additional info helps with your debugging. Many thanks again for the help with this. Kind regards, David RE: OnPermissionRequested from Powerbuilder - wila - 2022-06-09 David, There was a bug ... and on top of that Microsoft changed the interface and added a new parameter Handled. The new parameter was added to the parameter list asĀ I don't think many developers used the OnPermissionRequested event yet. The AntView control however does not currently support the Handled parameter yet. In order to be able to add support for it I would have to make too many changes due to it only having been introduced in WebView2 version 1.0.1185.39. The implementation for the Handled parameter will arrive in AntView version 1.2.x (soonish) The bug you bumped into was with State and that has now been fixed. There was also a possible code path that could prevent the event from getting triggered. I'm not entirely convinced that it was what prevented the event from working on your end, but we will see. If it still does not trigger then there is additional logging for us to see what happens. I will email you a link to a private build of the control by email. -- Wil RE: OnPermissionRequested from Powerbuilder - DavidS - 2022-06-09 Hi Wil, I downloaded and plugged in the new OCX and it worked perfectly first time. It's no problem to wait for version 1.2.x - now I know the application works, I can do a bit of tidying up and wait for the new version before implementing it. I cannot thank you enough for such quick and excellent response to my problem. It's highly impressive to get such good support. Many thanks again, David RE: OnPermissionRequested from Powerbuilder - wila - 2022-06-09 David, You can actually handle the popup already without the specific implementation of the new "Handled" parameter. If the event triggers then you only need to change the value of the variable State. Changing the value for State to anything else as the default then the WebView2 control will no longer issue the popup. At least it didn't popup anything anymore in my tests. Leaving the default will trigger the prompt, setting it to anything else makes it "Handled". Where Allow = 1 and Deny = 2. -- Wil RE: OnPermissionRequested from Powerbuilder - DavidS - 2022-06-09 That's brilliant Wil - I'll do that. Many thanks again, David |