Socio de confianza de Zoho en transformación digital
¡Su estructura de iframe es fundamentalmente correcta! Aquí está lo que está haciendo bien y áreas para optimizar:
<div class="vce-zoho-form-container">
<div class="loading-overlay" id="formLoader">
<div class="loading-spinner"></div>
<div class="loading-message">Cargando Formulario de Correo...</div>
</div>
<iframe name="Email_ZCRM_Frame"
id="zcrm-form-iframe"
src="https://creatorapp.zohopublic.com/yourappname/inventories/form-perma/Email_ZCRM/D0NZ3z6ykWzEEXxkwwEagkSPYOURKEYyvrw01f812SB8d7a21hqYWY9uKgyhOttVMeUgS2qfnsUOpO3dKG4CkHubnEuvDxsnO3D?DealID=<%=input.DealID%>"
style="width: 100%; border: none; transition: opacity 0.3s ease;"
frameborder="0"
scrolling="yes"
loading="lazy"
onload="hideLoader()"
onerror="showError()">
</iframe>
<div class="error-message" id="errorMessage" style="display: none;">
<p>No se puede cargar el formulario. <a href="#" onclick="reloadForm()">Inténtalo de nuevo</a></p>
</div>
</div>
.vce-zoho-form-container {
position: relative;
width: 100%;
max-width: 1200px;
margin: 0 auto;
background: #fff;
border-radius: 8px;
box-shadow: 0 2px 10px rgba(0,0,0,0.1);
overflow: hidden;
}
#zcrm-form-iframe {
width: 100%;
min-height: 600px;
height: 80vh;
max-height: 1000px;
opacity: 0;
transition: opacity 0.3s ease;
}
#zcrm-form-iframe.loaded {
opacity: 1;
}
.loading-overlay {
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
background: rgba(255,255,255,0.95);
display: flex;
flex-direction: column;
justify-content: center;
align-items: center;
z-index: 10;
}
.loading-spinner {
width: 40px;
height: 40px;
border: 4px solid #f3f3f3;
border-top: 4px solid #E53E3E;
border-radius: 50%;
animation: spin 1s linear infinite;
margin-bottom: 15px;
}
@keyframes spin {
0% { transform: rotate(0deg); }
100% { transform: rotate(360deg); }
}
.loading-message {
color: #666;
font-size: 16px;
font-weight: 500;
}
.error-message {
padding: 20px;
background-color: #ffebee;
color: #c62828;
text-align: center;
border-radius: 4px;
margin: 10px;
}
/* Mobile Responsive */
@media (max-width: 768px) {
.vce-zoho-form-container {
margin: 10px;
border-radius: 4px;
}
#zcrm-form-iframe {
min-height: 500px;
height: 70vh;
}
.loading-message {
font-size: 14px;
}
}
@media (max-width: 480px) {
#zcrm-form-iframe {
min-height: 400px;
height: 60vh;
}
}
function hideLoader() {
const loader = document.getElementById('formLoader');
const iframe = document.getElementById('zcrm-form-iframe');
if (loader) {
loader.style.display = 'none';
}
if (iframe) {
iframe.classList.add('loaded');
}
}
function showError() {
const loader = document.getElementById('formLoader');
const errorMsg = document.getElementById('errorMessage');
if (loader) {
loader.style.display = 'none';
}
if (errorMsg) {
errorMsg.style.display = 'block';
}
}
function reloadForm() {
const iframe = document.getElementById('zcrm-form-iframe');
const loader = document.getElementById('formLoader');
const errorMsg = document.getElementById('errorMessage');
if (errorMsg) {
errorMsg.style.display = 'none';
}
if (loader) {
loader.style.display = 'flex';
}
if (iframe) {
iframe.classList.remove('loaded');
iframe.src = iframe.src; // Recargar iframe
}
}
// Auto-redimensionar iframe basado en contenido (si es de mismo origen)
function autoResizeIframe() {
const iframe = document.getElementById('zcrm-form-iframe');
try {
if (iframe.contentDocument) {
const height = iframe.contentDocument.body.scrollHeight;
iframe.style.height = height + 'px';
}
} catch (e) {
// Restricción de cruzamiento de origen - usar altura fija
console.log('Auto-redimensionamiento no disponible debido a restricciones de origen cruzado');
}
}
// Respaldo de tiempo de espera
setTimeout(function() {
const loader = document.getElementById('formLoader');
if (loader && loader.style.display !== 'none') {
showError();
}
}, 15000); // 15 segundos de tiempo de espera
// En su script Deluge - validar y sanitizar parámetros
dealID = input.DealID;
// Validar que DealID existe y es numérico
if (dealID == null || dealID == "" || !dealID.isNumber()) {
dealID = "0"; // Valor predeterminado o redirigir a página de error
}
// Codificar URL para la seguridad
encodedDealID = encodeUrl(dealID);
// Construir URL de iframe seguro
iframeURL = "https://creatorapp.zohopublic.com/YOURAPPNAME/inventories/form-perma/Email_ZCRM/D0NZ3z6ykWzEEXZ7xkwwEagkSPYOURKEYs3yvrw01f812SB8d7a21hqYWY9uKgyhOttVMeUgS2qfnsUOpO3dKG4CkHubnEuvDxsnO3D?DealID=" + encodedDealID;
<iframe name="Email_ZCRM_Frame"
id="zcrm-form-iframe"
src="<%=iframeURL%>"
sandbox="allow-forms allow-scripts allow-same-origin allow-popups"
referrerpolicy="strict-origin-when-cross-origin"
loading="lazy">
</iframe>
<div class="mobile-fallback" style="display: none;">
<p>¿Problemas con el formulario? <a href="<%=iframeURL%>" target="_blank" class="btn-primary">Abrir en Nueva Ventana</a></p>
</div>
<script>
// Mostrar respaldo en móvil si el iframe falla
if (/Android|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent)) {
setTimeout(function() {
if (!document.getElementById('zcrm-form-iframe').classList.contains('loaded')) {
document.querySelector('.mobile-fallback').style.display = 'block';
}
}, 10000);
}
</script>
<link rel="preconnect" href="https://creatorapp.zohopublic.com">
<link rel="dns-prefetch" href="https://creatorapp.zohopublic.com">
// Carga perezosa avanzada con Intersection Observer
const iframeObserver = new IntersectionObserver((entries) => {
entries.forEach(entry => {
if (entry.isIntersecting) {
const iframe = entry.target;
if (iframe.dataset.src) {
iframe.src = iframe.dataset.src;
iframe.removeAttribute('data-src');
iframeObserver.unobserve(iframe);
}
}
});
});
// Usar data-src en lugar de src para carga perezosa
// <iframe data-src="your-url" ...>
// Comunicación PostMessage para ajuste de altura
window.addEventListener('message', function(event) {
if (event.origin === 'https://creatorapp.zohopublic.com') {
if (event.data.type === 'resize') {
const iframe = document.getElementById('zcrm-form-iframe');
iframe.style.height = event.data.height + 'px';
}
}
});
// Escuchar para completar el envío del formulario
window.addEventListener('message', function(event) {
if (event.origin === 'https://creatorapp.zohopublic.com') {
if (event.data.type === 'formSubmitted') {
// Manejar el envío exitoso
showSuccessMessage();
// Opcional: redireccionar o actualizar la página madre
}
}
});
¿Listo para mejorar sus aplicaciones de Zoho Creator? Cuando esté listo para implementar estas optimizaciones y explorar capacidades avanzadas de formularios, puede acceder a la plataforma completa de Zoho Creator en https://zurl.co/tNScV donde encontrará herramientas integrales para la creación de formularios, opciones avanzadas de iframe y características de diseño responsivas.
Scripts Deluge | Desarrollo Personalizado | Capacitación y Consultoría
creatorscripts@zoho.com | 8444552263
⭐ Orgulloso Ganador del Premio Tech Star en Cuidado de la Salud de Zoho Creator ⭐
Confiado por Empresas en Todo el Mundo
Este correo fue enviado automáticamente con Creator Scripts
© 2025 Creator Scripts - Socio de Confianza de Zoho en Transformación Digital