diff --git a/example/html/index.html b/example/html/index.html
index c26b1788c..02b84e9a0 100644
--- a/example/html/index.html
+++ b/example/html/index.html
@@ -32,6 +32,7 @@
Automagically resizing iFrame
src="../child/frame.content.html"
width="100%"
scrolling="no"
+ title="iframe-resizer content examples"
>
diff --git a/packages/core/index.js b/packages/core/index.js
index 54565e4cb..0ae8c646f 100644
--- a/packages/core/index.js
+++ b/packages/core/index.js
@@ -481,7 +481,7 @@ See https://iframe-resizer.com/setup/#child-page-setup> for more details.
}
function setTitle(title, iframeId) {
- if (!settings[iframeId]) return
+ if (!settings[iframeId]?.syncTitle) return
settings[iframeId].iframe.title = title
log(iframeId, `Set title attribute to: ${title}`)
}
@@ -1045,6 +1045,11 @@ The sizeWidth>, sizeHeight> and autoResize> options have been rep
settings[iframeId].postMessageTarget = iframe.contentWindow
}
+ function chkTitle(iframeId) {
+ const { title } = document.getElementById(iframeId)
+ return title === ''
+ }
+
function processOptions(options) {
settings[iframeId] = {
iframe,
@@ -1053,6 +1058,7 @@ The sizeWidth>, sizeHeight> and autoResize> options have been rep
...defaults,
...checkOptions(options),
mode: setMode(options),
+ syncTitle: chkTitle(iframeId),
}
setDirection()