diff --git a/example_iframe/zapp-iframe.js b/example_iframe/zapp-iframe.js index c7c5def..8e01825 100644 --- a/example_iframe/zapp-iframe.js +++ b/example_iframe/zapp-iframe.js @@ -91,6 +91,9 @@ window.onmessage = function (e) { opened = msg.state; dropdown.style.visibility = opened ? "visible" : "hidden"; button.contentWindow.postMessage(msg, "*"); + } else if (msg.type === "open-link") { + window.open(msg.url, '_blank').focus(); + button.contentWindow.postMessage(msg, "*"); } else { console.error("no supported msg type: " + msg.type); } diff --git a/zapp-iframe/.editorconfig b/zapp-iframe/.editorconfig new file mode 100644 index 0000000..5ae900f --- /dev/null +++ b/zapp-iframe/.editorconfig @@ -0,0 +1,9 @@ +root = true + +[*] +indent_style = tab +indent_size = 2 +end_of_line = lf +charset = utf-8 +trim_trailing_whitespace = true +insert_final_newline = true diff --git a/zapp-iframe/src/lib/components/Dropdown.svelte b/zapp-iframe/src/lib/components/Dropdown.svelte index 9f5a78f..d566b2c 100644 --- a/zapp-iframe/src/lib/components/Dropdown.svelte +++ b/zapp-iframe/src/lib/components/Dropdown.svelte @@ -82,7 +82,7 @@ '*' ); } - + const cookie = getCookie('zapp-labelson'); if(!cookie) labelson = true; else labelson = cookie === "true"; @@ -173,6 +173,10 @@ class="w95in1 w-25 h-25 style absolute" aria-label={app.img} title={app.tooltip} + onclick={(event) => { + window.parent.postMessage(JSON.stringify({ type: 'open-link', url: app.url }), '*'); + event.preventDefault(); + }} >