wxWebView Linux (WebKit) - AllowNavigationToInvalidURL Topic is solved

Do you have a typical platform dependent issue you're battling with ? Ask it here. Make sure you mention your platform, compiler, and wxWidgets version.
Post Reply
User avatar
saifcoder
Experienced Solver
Experienced Solver
Posts: 70
Joined: Thu Nov 16, 2017 9:32 pm

wxWebView Linux (WebKit) - AllowNavigationToInvalidURL

Post by saifcoder » Thu Jan 30, 2020 1:05 am

In same situation, I need to navigate to an invalid URL just to do same stuff in OnNewWindow(wxWebViewEvent& evt), in Windows wxWebView (Internet Explorer backend) it's allow navigation to an invalid URL in default, but in Linux (WebKit backend) show log error

Code: Select all

Unable to open a window with invalid URL '*@~MyBadUrl*'
Did this feature is missing in wxWebView on Linux (WebKit) platform ?

P.S:
https://github.com/WebKit/webkit/blob/9 ... .cpp#L2258

Code: Select all

AllowNavigationToInvalidURL::Yes
Debian 9 - GCC 6 - wxWidgets 3.1 U
Win 7 - GCC 5 - wxWidgets 3.1 U
Mac OS X 10.6 - GCC 4 - wxWidgets 3.1 U
i am in love with WX. Yes.

ONEEYEMAN
Part Of The Furniture
Part Of The Furniture
Posts: 3905
Joined: Sat Apr 16, 2005 7:22 am
Location: USA, Ukraine

Re: wxWebView Linux (WebKit) - AllowNavigationToInvalidURL

Post by ONEEYEMAN » Thu Jan 30, 2020 4:22 pm

Hi,
What WebView will render on Windows?
"Error 404: page "XXX" not found" or something similar?

Do you want to see the same on *nix?

Is WebKitGtk supports such a feature?

Besides why do you "need to navigate to an invalid URL"?

Thank you.

User avatar
saifcoder
Experienced Solver
Experienced Solver
Posts: 70
Joined: Thu Nov 16, 2017 9:32 pm

Re: wxWebView Linux (WebKit) - AllowNavigationToInvalidURL

Post by saifcoder » Fri Jan 31, 2020 1:04 am

There no error message in GUI, it's only won't create any event in OnNewWindow(wxWebViewEvent& evt) because the url is invalid.

while wen we run the same code in Windows the event created and we can catch the invalid url in OnNewWindow(wxWebViewEvent& evt).

We can fix this by encode bad url string, and decode it in OnNewWindow(wxWebViewEvent& evt), but I'm asking why WebKit not allow bad url as IE backend do?

And why we do that, because I tell my team the only one way to pass JavaScript variable value to C++ is by using OnNewWindow(), is there another way?

Thank you,
Debian 9 - GCC 6 - wxWidgets 3.1 U
Win 7 - GCC 5 - wxWidgets 3.1 U
Mac OS X 10.6 - GCC 4 - wxWidgets 3.1 U
i am in love with WX. Yes.

ONEEYEMAN
Part Of The Furniture
Part Of The Furniture
Posts: 3905
Joined: Sat Apr 16, 2005 7:22 am
Location: USA, Ukraine

Re: wxWebView Linux (WebKit) - AllowNavigationToInvalidURL

Post by ONEEYEMAN » Fri Jan 31, 2020 1:50 am

Hi,
saifcoder wrote:
Fri Jan 31, 2020 1:04 am
There no error message in GUI, it's only won't create any event in OnNewWindow(wxWebViewEvent& evt) because the url is invalid.

while wen we run the same code in Windows the event created and we can catch the invalid url in OnNewWindow(wxWebViewEvent& evt).

We can fix this by encode bad url string, and decode it in OnNewWindow(wxWebViewEvent& evt), but I'm asking why WebKit not allow bad url as IE backend do?

And why we do that, because I tell my team the only one way to pass JavaScript variable value to C++ is by using OnNewWindow(), is there another way?
Is it how its done in the webview sample?

Thank you.

User avatar
saifcoder
Experienced Solver
Experienced Solver
Posts: 70
Joined: Thu Nov 16, 2017 9:32 pm

Re: wxWebView Linux (WebKit) - AllowNavigationToInvalidURL

Post by saifcoder » Sat Feb 01, 2020 2:27 am

Same result in sample, because in default policy setting navigation to invalid url is not allowed, However, this is not important, a sample URL encode / decode can fix this.

Thank you sir.
Debian 9 - GCC 6 - wxWidgets 3.1 U
Win 7 - GCC 5 - wxWidgets 3.1 U
Mac OS X 10.6 - GCC 4 - wxWidgets 3.1 U
i am in love with WX. Yes.

Post Reply