Forum Xamarin.Forms

Trouble displaying html in webview with javascript

nike10nike10 Member ✭✭
edited February 5 in Xamarin.Forms

Hello, I am trying to request to payment gateway server using following code

using (HttpClient client = new HttpClient())
FormUrlEncodedContent content = new FormUrlEncodedContent(request);
var response = await client.PostAsync(url, content);
responseString = await response.Content.ReadAsStringAsync();

I am getting successful response from payment gateway and I am rendering response string to webview like this..

GatewaySource = new HtmlWebViewSource
Html = System.Web.HttpUtility.HtmlDecode(responseString)

response have html with loads of Javascript code but javascript is not working/injecting thus I can't go ahead with payment cycle.

Please find attached response file from payment gateway which I ain't able to display properly.


  • JohnHardmanJohnHardman GBUniversity admin

    @nike10 - To get your code to display correctly in your post, put three back-ticks on the line before your code and three back-ticks on the line after your code.

    You can either type the back-ticks, or you can have them added for you. To have them added, select your code in the post, then drop down the Format options (the sixth icon across on the toolbar when typing a post), and select Code.

  • LandLuLandLu Member, Xamarin Team Xamurai

    @ nike10 I tried to open your webpage on my desktop using a browser, however, I found it didn't have many functional buttons to be clicked. I can only click the back noForRetry link on your page. And it led to another page you haven't posted here.
    Could you specify which script of this page doesn't work? Please post the corresponding code to clearly point out the issue you are facing. The code above is used for retrieving the html file and you said it worked so it makes no sense here.

Sign In or Register to comment.