When user uses mouse middle button to click the HTLM dom element, chrome doesn't fire onclick
event.
Instead, it fires onauxclick
event. In blazor, we normally bind onclick
event like this:
1 | <a href="..." target="_blank" @onclick="Click"> |
But you can't do this for onauxclick
event. It will throw the following exception in runtime:
1 | blazor.webassembly.js:1 crit: Microsoft.AspNetCore.Components.WebAssembly.Rendering.WebAssemblyRenderer[100] |
From the exception, we know that, in this version of blazor, onauxclick
is not supported. So you need bind it like this:
1 | <a href="..." target="_blank" onauxclick="@((Action)(() => Click()))"> |
This way can also be used to bind other events which are not supported natively by blazor.