开发者

To disable the addressbar and standardbuttons bar in IE when my application lanches?

when my application launches in the IE from start page to main page i want to hide the addressbar and the standardbuttons bar of IE through the codebehind and here am using masterpage concept so i have to write the开发者_如何学运维 code in master only i think so....can anyone help for this


AFAIK you cannot disable address bar and button in IE from when the application starts unless using some ActiveX, Flash, ... Only if your application opens new window popups you could hide them.


I just found a way... It works atleast in IE 7... Not sure about other browsers...

<html>
<head>
<script>
 if (window.name == 'default') {
            window.name = 'Hai';
            window.open('main.html', '_self');  // Current html file name
        }
 else if(window.name == '') {
            window.name = 'Hai';
            window.open('main.html', '_self');  // Current html file name
        }
 else if(window.name == 'Hai') {
              // Use your application startup page here along with the desired options
        window.open('newfile.aspx','NEWWINDOWNAME', 'Status=0, location=0');  
                window.close();
        }
</script>
</head>
<body>
    This window automatically closes itself
</body>
</html>

The complete list of options are available here.

Hope this helps.

Explanation : (AFAIK) Generally when javascript uses window.close method to close the active window, IE will ask for a confirmation from the user. Such confirmation will not be asked when the window is a popup window opened previously by a javascript along with a name.

The above just fakes the same, by opening the same file in the same window but this time with a name. As a result when window.close is executed, IE recognises the current window as a window opened using Javascript and as it also has a name, it just closes the same without confirmation.

Of course, I get a general Javascript alert at the beginning of the load, but since (I presume) you will be using aspx or other types, this problem will not be there.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜