2
2 Comments

Laravel - Embed Form in another website using a script (example)

Hello wonderful community of IH :)

I found this script which is being sold on Codecanyon: https://socialproofo.com/demo/

They have a very interesting feature which is something I have been researching before stumbling upon this script.

They have a line of code (they call it a pixel) which can be placed on the end-users website and the code will inject the software being used by the user from the main application, from the end-users account in the application.

I was originally looking at iframes as I want to allow users to embed a form from my laravel application onto their own website (the users create their own forms in my software).

Does anyone understand what is going on here, or have an explanation of how this works? I just cannot fathom how UI, CSS, HTML and JS is being pulled from an online Saas application and being injected into a site all with one line of code? Genius I say!

Also would this sort of thing be achievable using a form in Laravel or am I correct continuing on the path of iframe?

I hope this is all ok and clear enough to understand, any questions I'd be more than happy to elaborate :)

Kindest Regards

posted to Icon for group Developers
Developers
on May 14, 2020
  1. 1

    Usually this kind of "widget injection" works like this:

    1. You add a script tag into your page html from your service provider (Not the laravel service provider, but another website which provides you witht the script code)
    2. That script generates styles and other required tags, gets stylesheets from provider servers and generates the ui.

    So basically the script injects all things that are needed for the widget. Usually it is a good practice to encapsulate cross site widgets into iframes as the styles/scripts of widget can potentially interfere and mess up with website.

    1. 1

      Thank you for your kind explanation, so it looks like using an iframe is the optimum way to go here :)

      Thank you once again.

Trending on Indie Hackers
7 years in agency, 200+ B2B campaigns, now building Outbound Glow User Avatar 102 comments 11 Weeks Ago I Had 0 Users. Now VIDI Has Reviewed $10M+ in Contracts - and I’m Opening a Small SAFE Round User Avatar 47 comments The "Book a Demo" Button Was Killing My Pipeline. Here's What I Replaced It With. User Avatar 41 comments I built a desktop app to move files between cloud providers without subscriptions or CLI User Avatar 24 comments How I built an AI workflow with preview, approval, and monitoring User Avatar 21 comments My AI bill was bleeding me dry, so I built a "Smart Meter" for LLMs User Avatar 19 comments