delphidelphi-xe5

How to remove border and scrollbars of TWebBrowser?


How can I remove border and scroll bars of a TWebBrowser component? i searched a lot and all answers were about same:

http://www.swissdelphicenter.com/torry/printcode.php?id=1171

http://delphidabbler.com/articles?article=18

but does not work (it do nothing!). in my case i want to view a local file in browser.

how can i hide border and scroll bars?


Solution

  • You can use css, the TWebbrowser uses internet explorer (an horror engine for webmaster -> overflow:hidden ). This style workaround works well for me (not in body node but in html ), in your local file try to add this style:

    <!doctype html>
    <html lang="en">
    <head>
     <meta charset="utf-8">
    <title></title>
    <style>
    html
    {
     position:fixed;
     overflow:hidden;
     -ms-overflow-style: none;
        border:0px;
     }</style>
     </head>
    <body>
     Test
    </body>
    </html>
    

    In my case it works (delphi xe 4 and windows 7), I made a webview with a small size without scrollbars.