diff --git a/web/app/components/base/html-preview-button/index.tsx b/web/app/components/base/html-preview-button/index.tsx
index b56b12f955..12ec733d31 100644
--- a/web/app/components/base/html-preview-button/index.tsx
+++ b/web/app/components/base/html-preview-button/index.tsx
@@ -30,7 +30,7 @@ const CreateIframeModal = ({ show, onClose, content }: CreateIframeModalProps) =
>
diff --git a/web/app/components/base/utils.ts b/web/app/components/base/utils.ts
index 53bcfa4857..e23f7672ff 100644
--- a/web/app/components/base/utils.ts
+++ b/web/app/components/base/utils.ts
@@ -1,6 +1,10 @@
export const isCompleteHTML = (code: string): boolean => {
- // simple check
- const completeHTMLRegex = /<\s*html\s*[^>]*>[\s\S]*<\/html\s*>/i
+ /**
+ * A simple check to determine if the input string is a complete HTML document.
+ * This function supports optional declarations and comments before the tag.
+ * Note: This is not a full HTML validator and may not handle all edge cases.
+ */
+ const completeHTMLRegex = /^(?:]*>\s*)?(?:\s*)*<\s*html\s*[^>]*>[\s\S]*<\/html\s*>/i
return completeHTMLRegex.test(code)
}