最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

Can a JavaScript modal dialog be modal only to the tab and not to the whole browser window? - Stack Overflow

programmeradmin0浏览0评论

Modern browsers have multi-tab interface, but JavaScript function window.showModalDialog() creates a modal dialog that blocks all of the tabs.

I'd like to know if there is a way to create a modal dialog that blocks only the tab it's been created in?

Modern browsers have multi-tab interface, but JavaScript function window.showModalDialog() creates a modal dialog that blocks all of the tabs.

I'd like to know if there is a way to create a modal dialog that blocks only the tab it's been created in?

Share Improve this question edited Nov 13, 2008 at 15:43 sblundy 61.4k22 gold badges123 silver badges124 bronze badges asked Nov 13, 2008 at 15:29 z-bossz-boss 17.6k13 gold badges54 silver badges82 bronze badges
Add a ment  | 

3 Answers 3

Reset to default 8

You could use one of the more 'Ajax-like' modal dialogs, which are just absolute positioned divs, floating on top of everything else.

Those are modal to the 'document' and not the browser.

For instance take a look it this jQuery plugin

P.S. showModalDialog() is an IE only call, so you might want to not use that altogether.

Nope. It's conceivable IE8's ‘loose coupling’ might behave like this at some point, but it doesn't in the current betas.

I second Michiel's remendation. A pseudo-modal-dialogue working by obscuring the rest of the page, floating a div on top, and calling the script back when it's finished, is both:

  • much more usable/less annoying than a real modal dialog
  • patible with any browser

showModalDialog/showModelessDialog themselves are generally to be avoided.

Firefox 3 supports window.showModalDialog (but it also blocks all tabs).

发布评论

评论列表(0)

  1. 暂无评论