In one of my Windows Phone application I am using webbrowser to display the html content. I am getting the html content by making post request to server. Here I am getting the response correctly.Then I am displaying this response in webbrowser by,
webBrowser.IsScriptEnabled = true;
webBrowser.NavigateToString(responseString);
The response is:
<html>
<HEAD>
<script language='JavaScript'>
</script>
<SCRIPT language='JavaScript' src='script/page.js'></SCRIPT>
<script type="text/javascript" charset="UTF-8" src="js/page2.js"></script>
</HEAD>
<BODY onload='someFunction()'>
<div>
--
<img src='Images/loader.gif' /><br /><br />
--
</div>
</BODY>
</HTML>
From here I am not able to call the page.js file, page2.js file and not able get the loader.gif image also. I think this is because the files are not locally stored.
I also tried by saving the response in Isolatedstorage as .html file. and displaying it
by using,
webBrowser.IsScriptEnabled = true;
webBrowser.Navigate(uri);
but here also I am getting same thing.
Please help me to get resolve this issue. Thanks in adcvance
The scripts and images aren't loaded, because paths to it in the html are relative. When you save it to a file, the scripts and image should be in relative locations to that file.
You should use webBrowser.Navigate
with the Uri
of the web page on the net (don't download it yourself, let the browser do it). Or the html has to have the full paths, like: <img src='http://contoso.com/Images/loader.gif' />
.