2013-02-27 62 views
4

我想在全屏幕中仅显示顶部可见的地址栏的弹出窗口。最小化和关闭按钮也应该是不可见的。目前我使用下面的代码,使我在全屏模式走在IE 9,但不显示即使位置= 1在javascript中显示带地址栏的全屏弹出窗口

function newPopup(url) { 
    popupWindow = window.open(
     url,'popUpWindow','height=700,width=800,left=10,top=10,resizable=no,scrollbars=no,toolbar=1,menubar=1,location=0,directories=1,status=0,channelmode=0,fullscreen=1') 
} 

回答

0

我不认为有一种方法,只显示在地址栏导航栏全屏显示 - 至少不是我能找到的。

如果是这种情况,您需要以编程方式重新创建地址栏,然后在使用地址栏时通过JavaScript重置您的位置。根据您的需要,您可以使用CSS样式使其看起来更像标准条。

我在下面的例子中充实了JS的更多内容;在窗体的submit事件中,您可以使用window.location.href在浏览器中导致重定向。输入可能需要大量操作才能使其成为工作网址(例如,在重置其位置之前,确保它是有效的地址)。

我还会考虑添加我们在普通浏览器中发现的那种功能,其中查询不被视为URL而被视为搜索。您可以使用以下Google Web API:https://developers.google.com/web-search/docs/

您将无法访问自动填充的浏览器历史记录,这可能通过保留常用访问站点的库并使用自动完成库来帮助您解决。

尽管这并不能直接回答你的问题,但我希望它能对你有所帮助。

HTML 
<div class="modal"> 
    <form> 
    <input type="text"></input> 
    </form> 
</div> 


JS 

(function(){ 

document.getElementById("nav-form").addEventListener("submit", function(e){ 
    var val = document.getElementById("nav-bar").value; 
    //parse and execute the navigation command 
    //in here, we would check to make sure it's valid, etc. 
    //and format it to make sure it's a working url 
    //and keep a case for if it's not a valid url, 
    //in which case you can leverage the google search api 
    window.location.href = val; 
}); 

}(window)); 

JS小提琴表示上述梗概:http://jsfiddle.net/x8heK/2/