English 中文(简体)
谷歌工具栏阻止打开新窗口。
原标题:Google Toolbar prevents open a new window

Google工具栏在我使用window.open打开一个窗口或者为anchor标签设置target="_blank"时,在IE 6中给我带来了严重的问题。它将窗口视为弹出窗口并显示弹出窗口已被阻止,而我真的不想向用户显示此信息。只有在window.open之前执行了额外的代码,例如在onclick中调用另一个方法然后使用window.open时才会出现此问题。有人能告诉我如何解决这个问题吗?

问题回答

工具栏和其他类似设备旨在保护用户免受不必要的弹出窗口的影响。它们唯一能够确定一个窗口是否“必要”的方式是确定是否在触发了用户主动事件的事件处理器中调用了 window.open,例如按钮点击。因此,如果您尝试在文档加载时或在 AJAX 成功处理程序中调用 window.open,工具栏(和其他阻止程序)将会认为该弹出窗口是可疑的。

除了像Buchan先生指出的那样告诉您的用户会有什么结果,您无法做任何事情。在可行的情况下,从点击处理程序直接启动您的弹出窗口。

更激进的改变将是远离window.open并使用由浮动元素制作的模拟弹出窗口,这些元素覆盖页面的一部分。换句话说,就像jQuery UI对话框所提供的那样。

将该网站添加到您的可信任站点列表中将起作用。

设置 target="_blank" 不应该触发弹出窗口阻止器。





相关问题
selected text in iframe

How to get a selected text inside a iframe. I my page i m having a iframe which is editable true. So how can i get the selected text in that iframe.

How to fire event handlers on the link using javascript

I would like to click a link in my page using javascript. I would like to Fire event handlers on the link without navigating. How can this be done? This has to work both in firefox and Internet ...

How to Add script codes before the </body> tag ASP.NET

Heres the problem, In Masterpage, the google analytics code were pasted before the end of body tag. In ASPX page, I need to generate a script (google addItem tracker) using codebehind ClientScript ...

Clipboard access using Javascript - sans Flash?

Is there a reliable way to access the client machine s clipboard using Javascript? I continue to run into permissions issues when attempting to do this. How does Google Docs do this? Do they use ...

javascript debugging question

I have a large javascript which I didn t write but I need to use it and I m slowely going trough it trying to figure out what does it do and how, I m using alert to print out what it does but now I ...

Parsing date like twitter

I ve made a little forum and I want parse the date on newest posts like twitter, you know "posted 40 minutes ago ","posted 1 hour ago"... What s the best way ? Thanx.

热门标签