最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

javascript - Disable address bar and back button in browser in html file - Stack Overflow

programmeradmin2浏览0评论

How can I disable address bar and back button in browser in html file?

Something Like this :

Here is the demo :/

JS:

$('.popup').click(function () {
    var curr_browser = navigator.appName;
    if (curr_browser == "Microsoft Internet Explorer") {
        window.opener = self;
    }
    window.open('/', 'null', 'width=900,height=750,toolbar=no,scrollbars=no,location=no,resizable =no');
    window.moveTo(0, 0);
    window.resizeTo(screen.width, screen.height - 100);
});

HTML:

<a target="_parent" href="javascript:void(0);" class="popup">Open new window</a> 

Right now its opening on click. I want to open it directly as popup. Like I double click on test.html , its should appear my html data and disabled address bar and with no back button.

How it can be done?

How can I disable address bar and back button in browser in html file?

Something Like this :

Here is the demo :http://jsfiddle/n5pKP/5/

JS:

$('.popup').click(function () {
    var curr_browser = navigator.appName;
    if (curr_browser == "Microsoft Internet Explorer") {
        window.opener = self;
    }
    window.open('http://www.google./', 'null', 'width=900,height=750,toolbar=no,scrollbars=no,location=no,resizable =no');
    window.moveTo(0, 0);
    window.resizeTo(screen.width, screen.height - 100);
});

HTML:

<a target="_parent" href="javascript:void(0);" class="popup">Open new window</a> 

Right now its opening on click. I want to open it directly as popup. Like I double click on test.html , its should appear my html data and disabled address bar and with no back button.

How it can be done?

Share Improve this question edited Jan 11, 2014 at 16:39 codingrose 15.7k11 gold badges40 silver badges58 bronze badges asked Jan 11, 2014 at 14:51 Hassan SardarHassan Sardar 4,52317 gold badges61 silver badges92 bronze badges 13
  • 1 Remove the onclick handler? – putvande Commented Jan 11, 2014 at 14:54
  • it will directly open the popup then, i dont want popup – Hassan Sardar Commented Jan 11, 2014 at 14:56
  • 1 you write "I want to open it directly as popup" in your question.. – Gabriele Petrioli Commented Jan 11, 2014 at 14:56
  • 1 You can't disable back button or address bar without opening a popup. – putvande Commented Jan 11, 2014 at 14:57
  • 1 I think by 'directly open as popup' the OP means the page initially opens like that of a popup (having the stuff disabled), which isn't possible unless a different page opens yours. – Gary Commented Jan 11, 2014 at 21:12
 |  Show 8 more ments

2 Answers 2

Reset to default 1

You may try like this

<input id="Button1" type="button" value="button" onclick="window.open('WebForm1.aspx','PoP_Up','directories=no,titlebar=no,toolbar=no,location=no,status=no,menubar=no,scrollbars=no,resizable=no,width=1024,height=768');" />

This is supported in top browser

The JavaScript API exists, just that due to security issues, browser vendors disabled the hiding of the address bar.

Hiding the address bar of a browser

Instead, you could make a modal within the browser window. Twitter Bootstrap or something like this: http://sandbox.scriptiny./tinybox2/

发布评论

评论列表(0)

  1. 暂无评论