要達到這個目的需要使用者端強制指定或是採用 IE7 的預設值,使用者端強制指定的部份沒啥好談的,只討論 IE7 預設值,請參閱附圖。
預設值為滑鼠游標指到的項目,若是強制指定時,則程式碼或 html 標籤無法配合。
依據 IE7 Developer 說明,在預設值下,若需要開啟在新頁籤 (索引標籤, tab) 上,不可以使用任何尺寸變更的語法,則自動會在新頁籤上開啟,語法參考如下:
<a href="test.htm" target=’_blank’>html 語法新頁籤視窗</a>
<a href=’javascript:newwindow = window.open("test.htm");’>script 語法新頁籤視窗</a>
經測試後,可在 IE7 上正常執行。

Document Object Model Changes

The ability to open multiple documents within the same browser window has certain practical and security implications. Consequently, many elements of the DOM behave differently when multiple tabs are open. In addition, active tabs (tabs with focus) cannot be affected by scripts run in inactive or background tabs.

For example, when only one tab is open or when tabbed browsing is disabled by the user, several window methods can affect the size, position, and appearance of the browser window. When more than one tab is open, however, these methods have no effect. This includes methods that resize, move, or otherwise change the appearance of the browser window. Similarly, the close method closes the active tab and the browser window remains open until the last tab closes.

Properties that change the appearance of a document are also limited to the active tab. For example, you can use the leftMargin property to control the left margin of the body element of the document in the tab, but you cannot change the left margin of a document in another tab.

Tabbed browsing also affects the DOM in other ways:

  • New windows open as pop-up windows if any of the following features are disabled: resizable, menubar, location, toolbar, status, and scrollbars; this includes open and showHelp.
  • When using the open method to open a new tab, the new tab becomes active if it was triggered through a user-initiated action, such as clicking a button. Otherwise, the new tab opens in the background and is inactive.
  • Tabs do not become active when scrolled.
  • In general, inactive tabs are not allowed to open windows or affect content in other tabs.
  • You cannot print from inactive tabs.
  • Window methods that display dialog boxes are ignored when called from inactive tabs; this includes alert, confirm, createPopup, prompt, showModalDialog, and showModelessDialog.
  • New tabs will flash (and change color) for modal dialogs and some modeless dialogs. Scripts in background tabs will be temporarily suspended and dialog will be suppressed until the user switches to the tab. In addition, modeless dialogs will hide previously shown dialogs if the user switches away from the current tab; it will be shown again when the user selects the tab again.
  • External methods that display dialog boxes are ignored when called by inactive tabs; this affects AddChannel, AddFavorite, and ShowBrowserUI.
  • The dragDrop method is ignored for objects in inactive tabs.

Because of these changes, you should carefully review any scripts that depend on these methods; they may no longer work as intended when tabbed browsing is enabled or when run on inactive tabs.

Categories: 技術分享 | 1 則迴響


One thought on “[IE7]如何新增視窗在Tab頁籤上

  1. 子璉

    IE7 CSS 變更說明:http://msdn2.microsoft.com/en-us/library/bb250496.aspx



WordPress.com Logo

您的留言將使用 WordPress.com 帳號。 登出 /  變更 )

Google+ photo

您的留言將使用 Google+ 帳號。 登出 /  變更 )

Twitter picture

您的留言將使用 Twitter 帳號。 登出 /  變更 )


您的留言將使用 Facebook 帳號。 登出 /  變更 )


連結到 %s

在 WordPress.com 建立免費網站或網誌.

%d 位部落客按了讚: