Hi! How can I disable scroll-bars in TWebBrowser component. I can find it.
Hi! How can I disable scroll-bars in TWebBrowser component. I can find it.
There are two properties in the Document.Body.Style property, named OverflowX and OverflowX. Simply set them to 'hidden' as shown in the code snippet below.
For more information on the TWebBrowser's document properties, see the other tips listed at the top.
Code:begin // .. with WebBrowser1.Document.Body.Style do begin OverflowX := 'hidden'; OverflowY := 'hidden'; end; { with WebBrowser1 } // .. end;
Well, I tried it, but there are 2-3 mistakes.
doesn't work. There are 3 errors.Code:WebBrowser1.Document.Style.OverflowX....
doesn't work, but there are 2 errors. The sign ":" causes 1 error and "end;" causes another error. Why?Code:WebBrowser1.OleObject.Body.Style.OverflowX...
What is the actual different between "...Document..." and "...OleObject..."?
See the attached files for more details.
This solution was used on other site, if you save the next code as index.htm and another html file to home.htm and then navigate the browser to index.htm then you get the home.htm page without the scrollbars. (just copied the htmlcode, so I have no idea what happens, it might be easier another way)
---------------------------------------
<html>
<head>
<title></title>
</head>
<script type="text/javascript">
// <![CDATA[
//check whether the frameset has been redirected to by a contentpage which has been loaded outside this frameset
var contentFrameStr = 'home.htm';
if(location.href.indexOf('?') != -1){
urlSplit = location.href.split('?');
paramSplit = urlSplit[1].split('=');
if(paramSplit[0] == "requestedPage"){
contentFrameStr = paramSplit[1];
}
}
var framesetStr = '<frameset id="mainFrame" rows="95, *" frameborder="no" border="0" framespacing="0">'; // border="0"
framespacing="0" are actually not tolerated by xhtml
framesetStr += '<frame src="menu.htm" id="topFr" name="topFr" marginwidth="0" frameborder="0" noresize="noresize"
scrolling="no"></frame>';
framesetStr += '<frame src="'+contentFrameStr+'" id="botFr" name="botFr" marginwidth="0" frameborder="0"
noresize="noresize" scrolling="no"></frame>';
framesetStr += '</frameset>';
parent.document.open();
parent.document.write(framesetStr);
parent.document.close();
/*if(document.getElementById) xhtmlHack();
function xhtmlHack(){
var el = document.getElementsByTagName('FRAMESET')[0];
el.setAttribute('frameborder', '0');
el.setAttribute('border', '0');
el.setAttribute('framespacing', '0');
//rameborder=no border=0 framespacing=0
el = document.getElementsByTagName('FRAME')[0];
el.setAttribute('scrolling', 'no');
el.setAttribute('resize', 'false');
el.setAttribute('border', '0');
el.setAttribute('marginwidth', '0');
el.setAttribute('marginheight', '0');
//marginwidth=0 noresize scrolling="no"
el = document.getElementsByTagName('FRAME')[1];
el.setAttribute('scrolling', 'no');
el.setAttribute('resize', 'false');
el.setAttribute('border', '0');
el.setAttribute('marginwidth', '0');
el.setAttribute('marginheight', '0');
}*/
//]]>
</script>
</html>
---------------------------------------
and another page as home.htm
Patience is a virtue
EINSTEIN_007's code makes mire sense.
Bookmarks