WebHtmlViewer Gray Default Background

When WebHtmlViewer is used to display a web page for a Xojo Web app, I noticed that it defaults to a gray background rather than a white background like all other browsers I’ve tested on Mac and Windows. Websites that do not explicitly define a background color look odd. The HtmlViewer component in a Xojo Desktop app does seem to default to white background so websites look normal.

Is there a way to set the default background color for WebHtmlViewer to white so websites in a Xojo Web app look okay like they do for a Xojo Desktop app?

Do you have examples of sites that do not display adequately ?

For demonstration, this web page displays with a gray background in WebHtmlViewer, but a white background in every other web browser I have tried. If a website contains images with irregular shaped images with white background (instead of transparent backgrounds), everything looks odd in WebHtmlViewer.

I’m sure every web page could set the desired background color with HTML or CSS, but it would be nice to default WebHtmlViewer to white background to be consistent with other web browsers.

I don’t know any way to change the color of the background for an iFrame, since it is normally off limit when the page is not on the same domain.

But for your particular page, you could use

<body {background-color: white;}>


Although you could put instead on an HTML page your buttons on a WebPage within ImageWells (WebImageView), and use the email code as URL.

That would give you a lot more control over the layout.

If the WebPage style has a white background, the WebHTMLViewer has a white background.

Adding a White background style to WebPage does the trick.