wanting to use Safari with wxWebView 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
DavidKlecker
Filthy Rich wx Solver
Filthy Rich wx Solver
Posts: 232
Joined: Sun Nov 29, 2009 10:35 am

wanting to use Safari with wxWebView

Post by DavidKlecker »

I am noticing that in using wxWebView in OSX it uses Chrome by default. Unfortunately Chrome doesn't work well with xmlhttprequest but Safari does. Is there a way to have wxWebView in OSX use Safari? I have tried to make Safari the default browser on my machine but that didn't work.

Thanks!
User avatar
doublemax
Moderator
Moderator
Posts: 19116
Joined: Fri Apr 21, 2006 8:03 pm
Location: $FCE2

Re: wanting to use Safari with wxWebView

Post by doublemax »

Use the source, Luke!
DavidKlecker
Filthy Rich wx Solver
Filthy Rich wx Solver
Posts: 232
Joined: Sun Nov 29, 2009 10:35 am

Re: wanting to use Safari with wxWebView

Post by DavidKlecker »

Thanks for the link. That helps, however there seems to be an issue with it displaying javascript. I tested the connection through whatismybrowser.com which worked. I also tested the html with the javascript by simply opening the html file manually with the proper arguments and that also works. However the application doesn't seem to even as far as displaying the contents of the html page itself, let alone calling the javascript on the page. I have the following code for wxWebKitCtrl

wxWebKitCtrl *itemHtmlWindow3 = new wxWebKitCtrl(itemDialog1, ID_HTMLWINDOWPRINT, str, wxDefaultPosition, wxDefaultSize);
itemHtmlWindow3->LoadURL(PrintPath); //Where printpath is string with the location of the html following by a hashtag and the argument being passed.

The html being called has the following code

Code: Select all

<html>
	<head>
		<meta http-equiv="content-type" content="text/html; charset=iso-8859-1" />
		<meta name="author" content="David Klecker" />
		<meta name="keywords" content="" />
		<meta name="description" content="" />
		<script type="text/javascript" src="printCharacter.js">	</script>
		<title></title>
	</head>

	<body onLoad="javascript:Main()">
	Hello1
	</body>
</html>
It's a simple html file. The interesting thing here is I don't even see Hello1. If I put the string above into Safari manually, it works. So I'm confused as to why this html is not getting called at all unless I missed a part of the wxWebKitCtrl class.

Thanks!
User avatar
doublemax
Moderator
Moderator
Posts: 19116
Joined: Fri Apr 21, 2006 8:03 pm
Location: $FCE2

Re: wanting to use Safari with wxWebView

Post by doublemax »

Is the html file local or remote?
Does it work when you don't pass any parameters to the URL?
Try some inline JS code for a test, maybe the external .js file is not found.
Use the source, Luke!
DavidKlecker
Filthy Rich wx Solver
Filthy Rich wx Solver
Posts: 232
Joined: Sun Nov 29, 2009 10:35 am

Re: wanting to use Safari with wxWebView

Post by DavidKlecker »

Whoops! Nevermind I just discovered that the error lies in having a space in the URL. I did a string.replace on all spaces and replaced with %20 and now it works just fine. Thanks for the help!
Post Reply