In the recent project I had to open the page without browser's menu bar, toolbar and also without address bar. So I tried following to achieve my goal...
Before the default page I put a html page and on its body onload called a user defined wininit() method which first opens the default page and after that closes the contained page.
wininit() method first opens the default page (the page we are willing to open) and again opens a blank page with target= _self and then closes it.
Here is our wininit() method...
function wininit()
{
var win = window.open("index.aspx", "HomeOpener", "status=0, toolbar=0, menubar=0, resizable=1, width=" + screen.availWidth + ", height = " + screen.availHeight + '"');
win.moveTo(0, 0);
window.open('', '_self', '');
window.close();
}
Here index.aspx is our default page.
Notice that we are opening a blank page before calling the window.close() method. It is done all because it could produce a warning message for closing the window.
Also notice that new window is open as maximized as its width and height is set as screen height and width.
Put the wininit() method in head block and call it on body onload.
Note: It works fine with IE and Google Chrome but in Mozilla Firefox it opens the default window as per our desire but does not close the container page.
No comments:
Post a Comment