Kirix Support Forums

Vetoing page transitions

Please post all general questions, comments, bug reports, and any other wxWebConnect feedback here.

Vetoing page transitions

Postby MrD on Tue Jan 25, 2011 2:50 pm

Oh no! It's me again :)

I have one thing left to get working before my proof of concept is complete, and that is the ability to veto page transitions. This is because I'm using wxWebConnect to show a UI, and instead want to redirect these would be transitions to other things.

There are two main parts to this:
  1. There will be some specially formatted links that are internal commands and need to be treated specially.
  2. Any other links will need redirecting to the users normal web-browser.
Because of this I will need access to the contents of the anchor tag that caused the page transition.

I was hoping this would be as simple as vetoing all wxEVT_WEB_LOCATIONCHANGE events, and then reading the anchor value from a wxEVT_WEB_LEFTUP event, however this is not the case. I assume this is because these events are sent as notification that XulRunner has done something, rather than an actual veto-able event :(

The only thing I found close to attempting this was this thread, however that isn't suitable in my case as I want to stop all transitions of the current page (something that thread doesn't solve).

Any help is appreciated.
MrD
Registered User
 
Posts: 20
Joined: Mon Jan 10, 2011 6:26 pm

Re: Vetoing page transitions

Postby jonmmorgan on Tue Jan 25, 2011 10:16 pm

I think what you want is wxEVT_WEB_OPENURI. This is what I use, and if you Veto() it it will not open the URI. You can get the URL being loaded with event.GetHref().
If you like, with this method you can use custom protocols to communicate any arbitrary information (e.g. random://content/mycontent?param1=z&param2=x).
jonmmorgan
Registered User
 
Posts: 94
Joined: Fri May 14, 2010 9:48 am

Re: Vetoing page transitions

Postby MrD on Wed Jan 26, 2011 1:44 pm

Ah yes, that was indeed what I wanted. I assumed it would only be fired from a call to OpenURI, and not from any links on the page.

Now I can have a stab at making this do something more productive than just show "Hello World!" and have a link to Google :D
MrD
Registered User
 
Posts: 20
Joined: Mon Jan 10, 2011 6:26 pm

Return to wxWebConnect Questions, Thoughts & Feedback