From 4cf73877d5c908d64e75569c3410ca86491eae95 Mon Sep 17 00:00:00 2001 From: Gabe Varela Date: Thu, 23 Jan 2025 09:59:54 -0700 Subject: [PATCH] Iframe ColdBootVisit bug example --- public/javascript/application.js | 2 ++ public/javascript/controllers/iframe_controller.js | 9 +++++++++ views/index.ejs | 11 +++++++++++ 3 files changed, 22 insertions(+) create mode 100644 public/javascript/controllers/iframe_controller.js diff --git a/public/javascript/application.js b/public/javascript/application.js index 5395129..3c9db01 100644 --- a/public/javascript/application.js +++ b/public/javascript/application.js @@ -4,6 +4,7 @@ import "@hotwired/hotwire-native-bridge" // Controllers import MenuController from "./controllers/menu_controller.js" +import IframeController from "./controllers/iframe_controller.js" // Bridge Components import BridgeFormController from "./controllers/bridge/form_controller.js" @@ -15,6 +16,7 @@ window.Stimulus = Application.start() // Register Controllers Stimulus.register("menu", MenuController) +Stimulus.register("iframe", IframeController) // Register Bridge Components Stimulus.register("bridge--form", BridgeFormController) diff --git a/public/javascript/controllers/iframe_controller.js b/public/javascript/controllers/iframe_controller.js new file mode 100644 index 0000000..dab2109 --- /dev/null +++ b/public/javascript/controllers/iframe_controller.js @@ -0,0 +1,9 @@ +import { Controller } from "@hotwired/stimulus" + +export default class extends Controller { + static targets = [ "form", "iframe" ] + + connect() { + this.formTarget.submit() + } +} diff --git a/views/index.ejs b/views/index.ejs index 798c7ea..afde41b 100644 --- a/views/index.ejs +++ b/views/index.ejs @@ -57,6 +57,10 @@ Follow an external redirect + + + Load an iframe + See how files work @@ -89,3 +93,10 @@ + +
+
+
+ +