# HTML scaling for WebHTMLViewer

**URL:** <https://forum.xojo.com/t/html-scaling-for-webhtmlviewer/15667>\
**Category:** Web\
**Created:** [April 10, 2014, 8:21pm UTC](https://forum.xojo.com/t/html-scaling-for-webhtmlviewer/15667 "2014-04-10T20:21:05Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![Tony\_Harris](https://forum.xojo.com/letter_avatar_proxy/v4/letter/t/d2c977/32.png) [@Tony\_Harris](https://forum.xojo.com/u/Tony_Harris)\
**Post date:** [April 10, 2014, 8:21pm UTC](https://forum.xojo.com/t/html-scaling-for-webhtmlviewer/15667/1 "2014-04-10T20:21:05Z")

</div>

Is there a flag for it? I didn’t see anything in the docs, but I have a web page I need to display during my app execution, I am able to load and display the page, but it doesn’t scale it to fit in the box I assigned so it has a horizontal scroll bar (a vertical one is no big deal) - is there a way to get it to scale the content to fit in a horizontal space?

---

<div class="post-metadata">

**Author:** ![Axel\_Schneider](https://forum.xojo.com/user_avatar/forum.xojo.com/axel_schneider/32/465_2.png) [@Axel\_Schneider](https://forum.xojo.com/u/Axel_Schneider)\
**Post date:** [April 11, 2014, 2:13am UTC](https://forum.xojo.com/t/html-scaling-for-webhtmlviewer/15667/2 "2014-04-11T02:13:39Z")

</div>

works on OSX

`
HTMLViewer1.ExecuteJavaScript "document.body.style.zoom=""80%"""`

---

<div class="post-metadata">

**Author:** ![Dan\_Oja](https://forum.xojo.com/letter_avatar_proxy/v4/letter/d/54ee81/32.png) [@Dan\_Oja](https://forum.xojo.com/u/Dan_Oja)\
**Post date:** [February 28, 2015, 5:19pm UTC](https://forum.xojo.com/t/html-scaling-for-webhtmlviewer/15667/3 "2015-02-28T17:19:25Z")

</div>

@Axel: Thank you for posting this solution. I had been wrestling with this for a while as most of the zooming options don’t seem to work with a WebKit HTMLViewer on Windows. The above solution worked just fine!

---

<div class="post-metadata">

**Author:** ![Michel\_Bujardet](https://forum.xojo.com/user_avatar/forum.xojo.com/michel_bujardet/32/252_2.png) [@Michel\_Bujardet](https://forum.xojo.com/u/Michel_Bujardet)\
**Post date:** [February 28, 2015, 7:05pm UTC](https://forum.xojo.com/t/html-scaling-for-webhtmlviewer/15667/4 "2015-02-28T19:05:39Z")

</div>

[quote=78673:@Axel Schneider]works on OSX

`
HTMLViewer1.ExecuteJavaScript "document.body.style.zoom=""80%"""`[/quote]

Works on Windows as well with both Native and Webkit renderer 🙂

---

<div class="post-metadata">

**Author:** ![Richard\_Brown](https://forum.xojo.com/letter_avatar_proxy/v4/letter/r/9d8465/32.png) [@Richard\_Brown](https://forum.xojo.com/u/Richard_Brown)\
**Post date:** [March 2, 2015, 10:28pm UTC](https://forum.xojo.com/t/html-scaling-for-webhtmlviewer/15667/5 "2015-03-02T22:28:02Z")

</div>

Possibly drifting slightly OT, but a solution I came across here for showing scaled imaged that you only have the URL of without scroll bars was this:

```auto
HTMLViewer.LoadPage("<img src=""" + pic + """style=""height:100%;""><Style type=""text/css""> body {overflow: hidden; margin-top: 0px; margin-left: 0px;} </Style>",Nil)
```

…where “pic” is a string containing the URL.

You can then just resize the HTML Viewer in the IDE and it just works really nicely.

---

<div class="post-metadata">

**Author:** ![system](https://forum.xojo.com/uploads/default/original/1X/455b4dcc0e61630e9f81940004ddffa49c432a46.png) [@system](https://forum.xojo.com/u/system)\
**Post date:** [October 29, 2020, 5:10pm UTC](https://forum.xojo.com/t/html-scaling-for-webhtmlviewer/15667/6 "2020-10-29T17:10:20Z")

</div>


