Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

231
Views
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 answers
Answer question

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 Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!