From e7abfbc4974e5ae414135b768a8e781f132cfd7c Mon Sep 17 00:00:00 2001 From: lmluat-axonivy Date: Mon, 30 Dec 2024 11:18:29 +0700 Subject: [PATCH 1/3] feature/IVYPORTAL-18210-SecurityError-happens-when-reloading-with-iframe-inside-external-page-widget - Update function reloadIframes to match the same origin policy --- AxonIvyPortal/portal/webContent/resources/js/portal.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/AxonIvyPortal/portal/webContent/resources/js/portal.js b/AxonIvyPortal/portal/webContent/resources/js/portal.js index 48e5a524a4..2ca21dede9 100644 --- a/AxonIvyPortal/portal/webContent/resources/js/portal.js +++ b/AxonIvyPortal/portal/webContent/resources/js/portal.js @@ -392,7 +392,7 @@ function getWidgetVarById(id) { function reloadIframes() { var iframes = document.querySelectorAll('iframe'); iframes.forEach(function(iframe) { - iframe.contentWindow.location.reload(); + iframe.src = iframe.src; }); } From f4d013d3675cc9376346ea9e81f9523ac0aedd5e Mon Sep 17 00:00:00 2001 From: lmluat-axonivy Date: Mon, 30 Dec 2024 14:42:34 +0700 Subject: [PATCH 2/3] feature/IVYPORTAL-18210-SecurityError-happens-when-reloading-with-iframe-inside-external-page-widget - Update reloadIframes -> reloadIframesInsidePortalAIChat --- .../portal/webContent/resources/js/portal.js | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/AxonIvyPortal/portal/webContent/resources/js/portal.js b/AxonIvyPortal/portal/webContent/resources/js/portal.js index 2ca21dede9..23b43079dd 100644 --- a/AxonIvyPortal/portal/webContent/resources/js/portal.js +++ b/AxonIvyPortal/portal/webContent/resources/js/portal.js @@ -389,11 +389,15 @@ function getWidgetVarById(id) { } -function reloadIframes() { - var iframes = document.querySelectorAll('iframe'); - iframes.forEach(function(iframe) { - iframe.src = iframe.src; - }); +function reloadIframesInsidePortalAIChat() { + var iframeInsidePortalAIChat = document.getElementById('iFrame'); + if (iframeInsidePortalAIChat) { + var contentInsideIframe = iframeInsidePortalAIChat.contentDocument || iframeInsidePortalAIChat.contentWindow.document; + var iframes = contentInsideIframe.getElementsByClassName('message-iframe'); + for (let item of iframes) { + item.src = item.src; + } + } } function handleKeyDown(event) { From 08b306b5b714b2e2e4b176c1faa5e768065d1629 Mon Sep 17 00:00:00 2001 From: lmluat-axonivy Date: Mon, 6 Jan 2025 15:53:43 +0700 Subject: [PATCH 3/3] feature/IVYPORTAL-18210-SecurityError-happens-when-reloading-with-iframe-inside-external-page-widget - Rename function --- AxonIvyPortal/portal/webContent/layouts/includes/topbar.xhtml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/AxonIvyPortal/portal/webContent/layouts/includes/topbar.xhtml b/AxonIvyPortal/portal/webContent/layouts/includes/topbar.xhtml index dd95d5f82b..bef0bb7f12 100644 --- a/AxonIvyPortal/portal/webContent/layouts/includes/topbar.xhtml +++ b/AxonIvyPortal/portal/webContent/layouts/includes/topbar.xhtml @@ -50,7 +50,7 @@ -