2
我試圖創建一個彈出窗口,顯示瀏覽器工具欄並允許編輯URL,就像正常的瀏覽器窗口一樣。這是用於定製CMS後端的鏈接,以便用戶查看移動格式的網站。我知道window.open()的默認行爲是toolbar = yes,location = yes和menubar = yes,但是當使用Chrome瀏覽器時,我得到一個彈出窗口,它有一個無法編輯的URL字段,並且沒有無論我使用什麼設置,都可以重新加載按鈕。在Firefox和Safari中運行良好。Javascript彈出窗口打開SHOW工具欄並在Chrome中編輯URL
下面是我使用的代碼:
<script>
function popupwindow(url, title, w, h) {
var left = (screen.width/2)-(w/2);
var top = (screen.height/2)-(h/2);
return window.open(url, title, 'toolbar=yes, location=yes, directories=no, status=no, menubar=yes, scrollbars=yes, resizable=no, copyhistory=no, width='+w+', height='+h+', top='+top+', left='+left);
}
</script>
<a href="/?format=mobile" onclick="popupwindow('/?format=mobile', 'Mobile App', 336, 480); return false;">
Launch App
</a>