天天看點

一段有關JavaScript的翻譯

          産生許多浏覽器視窗和改變目前的視窗是JavaScript非常常見的用途。這些用途非常令人厭煩而且還不安全,因為你永遠無法确定你網頁的訪客是否能夠處理調整了的視窗或者當有新的視窗時會被她的使用者代理通知到。想象一下傾聽你的網站的螢幕閱讀使用者或文本浏覽器使用者。視窗過去常被用作沒有請求的廣告(彈出廣告)以及在隐藏的視窗中執行代碼以擷取資料(網絡釣魚),這就是為什麼浏覽器制造商和第三方軟體供應商提供了許多軟體和浏覽器設定來阻止這些濫用的行為。Mozilla firefox使用者可以選擇他們是否想要彈出視窗以及使用JavaScript可以改變什麼視窗屬性。如圖6-11所示。

      其它的一些浏覽器如MSIE 7或Opera 8不允許隐藏新視窗的位址欄且可以強制改變新視窗的大小和位置限制。

原文:

Windows and JavaScript

Spawning new browser windows and altering the current window are very common uses for

JavaScript. These are also very annoying and unsafe, as you can never be sure if the visitor of

your web page can deal with resized windows or will be notified by her user agent when there

is a new window. Think of screen reader users listening to your site or text browser users.

Windows have been used for unsolicited advertising (pop-up windows) and executing

code in hidden windows for data retrieval purposes (phishing) in the past, which is why

browser vendors and third-party software providers have come up with a lot of software

and browser settings to stop this kind of abuse. Mozilla Firefox users can choose whether

they want pop-up windows and what properties of the window can be changed by JavaScript

as shown in Figure 6-11.

Figure 6-11. The advanced JavaScript settings in Mozilla Firefox

Other browsers like MSIE 7 or Opera 8 disallow hiding the location bar in new windows

and can impose size and position constraints on new windows.

繼續閱讀