I've a HTML & JavaScript code locally loaded into a WebBrowser
control. The JavaScript code tries loading some data from a url using ajax. I can change the request url to a custom url (something like: app://request1
), but I've no idea how to manage the content that should be returned to the ajax http request (through WebBrowser
control)! I can see requested URLs by handling Navigating
event of WebBrowser
control, but there is nothing to set as a return value for the request.
Something like:
private void webBrowser1_Navigating(object sender,
WebBrowserNavigatingEventArgs e)
{
switch(e.Url.AbsoluteUri)
{
case "app://request1":
e.ResponseString = "response string 1";
break;
case "app://request2":
e.ResponseString = "response string 2";
break;
}
}
I've searched a lot but found nothing.
one idea that has crossed my mind is implementing a local http server (tcp socket listening on a specific port number) and change the ajax request url to that local listening socket.
Aucun commentaire:
Enregistrer un commentaire