mirror of
https://github.com/tauri-apps/plugins-workspace.git
synced 2026-04-21 11:26:15 +02:00
fix(opener): doesn't open same origin links (#3018)
This commit is contained in:
@@ -0,0 +1,6 @@
|
||||
---
|
||||
"opener": patch
|
||||
"opener-js": patch
|
||||
---
|
||||
|
||||
Fix opener doesn't open same origin links in the browser
|
||||
@@ -46,10 +46,8 @@ window.addEventListener('click', function (evt) {
|
||||
|
||||
// return early if
|
||||
if (
|
||||
// same origin (internal navigation)
|
||||
url.origin === window.location.origin
|
||||
// not default protocols
|
||||
|| ['http:', 'https:', 'mailto:', 'tel:'].every((p) => url.protocol !== p)
|
||||
['http:', 'https:', 'mailto:', 'tel:'].every((p) => url.protocol !== p)
|
||||
)
|
||||
return
|
||||
|
||||
|
||||
@@ -1 +1 @@
|
||||
!function(){"use strict";"function"==typeof SuppressedError&&SuppressedError,window.addEventListener("click",(function(e){if(e.defaultPrevented||0!==e.button||e.metaKey||e.altKey)return;const t=e.composedPath().find((e=>e instanceof Node&&"A"===e.nodeName.toUpperCase()));if(!t||!t.href||"_blank"!==t.target&&!e.ctrlKey&&!e.shiftKey)return;const n=new URL(t.href);n.origin===window.location.origin||["http:","https:","mailto:","tel:"].every((e=>n.protocol!==e))||(e.preventDefault(),async function(e,t={},n){window.__TAURI_INTERNALS__.invoke(e,t,n)}("plugin:opener|open_url",{url:n}))}))}();
|
||||
!function(){"use strict";"function"==typeof SuppressedError&&SuppressedError,window.addEventListener("click",(function(e){if(e.defaultPrevented||0!==e.button||e.metaKey||e.altKey)return;const t=e.composedPath().find((e=>e instanceof Node&&"A"===e.nodeName.toUpperCase()));if(!t||!t.href||"_blank"!==t.target&&!e.ctrlKey&&!e.shiftKey)return;const n=new URL(t.href);["http:","https:","mailto:","tel:"].every((e=>n.protocol!==e))||(e.preventDefault(),async function(e,t={},n){window.__TAURI_INTERNALS__.invoke(e,t,n)}("plugin:opener|open_url",{url:n}))}))}();
|
||||
|
||||
Reference in New Issue
Block a user