Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

228
Vistas
Flutter web embed form using js

I am trying to embed a form from https://convertkit.com/ending-a-business-relationship onto my flutter Webpage. This has been super difficult and I can't seem to figure out why there isn't some easy system like with flutter apps.

So far I have set it up like this:

import 'package:flutter/material.dart';
import 'package:mygamedevpal/shared/appbar_desktop.dart';
import 'dart:js' as js;
import 'dart:html' as html;
import 'dart:ui' as ui;

class MyDesktopBody extends StatelessWidget {
  const MyDesktopBody({Key? key}) : super(key: key);

  @override
  Widget build(BuildContext context) {
    final currentWidth = MediaQuery.of(context).size.width;
    return Scaffold(
      appBar: AppBarDesktop(),
      body: Center(
        child: Iframe(),
        // child: Text(
        //   "COMING SOON!",
        //   style: Theme.of(context).textTheme.bodyLarge,
        //   textAlign: TextAlign.center,
      ),
    );
  }
}

class Iframe extends StatelessWidget {
  Iframe() {
    // ignore: undefined_prefixed_name
    ui.platformViewRegistry.registerViewFactory('iframe', (int viewId) {
      var iframe = html.IFrameElement();
      iframe.src = 'https://app.convertkit.com/forms/3425056/subscriptions';
      return iframe;
    });
  }

  @override
  Widget build(BuildContext context) {
    return Container(
        width: 800, height: 600, child: HtmlElementView(viewType: 'iframe'));
  }
}

However this gives me the following error:

Refused to display 'https://app.convertkit.com/' in a frame because it set 'X-Frame-Options' to 'sameorigin'.

I read people saying to add embed to it however this just leads to a 404 from the website. Is there really no simple way to embed a form from another site using js for flutter websites?

Thanks in advance!

about 4 years ago · Santiago Gelvez
1 Respuestas
Responde la pregunta

0

When using Flutter, you should probably use a webview widget such as webviewx instead of using dart:html and friends!

But that will probably not solve the actual error message, because it means that Convertkit forbids you to embed that URL in an <iframe>! You need to check with Convertkit how to embed correctly.

SAMEORIGIN

The page can only be displayed in a frame on the same origin as the page itself.

Source: https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/X-Frame-Options

about 4 years ago · Santiago Gelvez Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda