Page 1 of 1

Default window size for webhelp?

Posted: Tue Jan 03, 2017 7:52 pm
by shudson310
I have a requirement to force the initial window size for webhelp content to 580x700. How can I set this initial window size? I've tried setting:

Code: Select all


<script Language="JavaScript">
var width=580;
var height=700;
self.moveTo((screen.availwidth-width)/2,(screen.availheight-height)/2);
self.resizeTo(width,height);
</script>
in wt_index.html, wt_search.html, wt_terms.html and wt_topic.html, but it does not appear to change the default window size.

Re: Default window size for webhelp?

Posted: Wed Jan 04, 2017 5:32 pm
by bogdan_cercelaru
Hello,

You cannot resize or set the position of a browser window on the page load.
You can change only the properties of a new window opened by your script. This means that you should open a new window and set the properties you want: width, height, offset top and offset left.
Here is the script that will do this:

Code: Select all


<script>
var myWindow;

var width=580;
var height=700;
var availHeight = screen.availHeight;
var availWidth = screen.availWidth;
var positionX = (availWidth-width)/2;
var positionY = (availHeight-height)/2;
var requestedURL = window.location;

if (window.name!=="myWindow") {
window.document.write("<p>This page open a new WebHelp window!</p>");
myWindow = window.open(requestedURL, "myWindow", "width=" + width + ", height=" + height + ", left=" + positionX + ", top=" + positionY);
myWindow.focus();
window.stop();
}
</script>
You have to include it in the wt_index.html, wt_search.html, wt_terms.html and wt_topic.html files.


Regards,
Bogdan