2013-02-27 56 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/