Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

230
Visualizações
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 Respostas
Responde à pergunta

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 Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda