通过端口调用window.open [英] Calling window.open through port

查看:95
本文介绍了通过端口调用window.open的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在实施社交身份验证。当用户单击按钮时,我发送命令,以便可以调用 window.open()

I'm implementing social auth. When the user clicks on a button, I send a command so I can call window.open().

查看此调用堆栈,我们可以看到在下一个事件循环中调用了端口处理程序:

Looking at this call-stack, we can see that the port handler is called in the next event loop:

由于在点击事件生命周期内未调用 window.open ,因此类似safari的浏览器不允许弹出窗口出现。

Since window.open is not being called within the click event lifecycle, browsers like safari do not allow for the popup to show up.

您的方法是什么?

推荐答案

这不是超级漂亮,但是您可以执行以下操作

It's not super pretty, but you can do something like

a 
    [ Html.Attributes.attribute "onClick" "window.open(this.href, this.target, 'width=800,height=600'); return false;" ]
    [ text "Click me" ]

这篇关于通过端口调用window.open的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆