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

  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
How I grew a side project to 100k Unique Visitors in 7 days with 0 audience 49 comments Competing with Product Hunt: a month later 33 comments Why do you hate marketing? 29 comments My Top 20 Free Tools That I Use Everyday as an Indie Hacker 16 comments $15k revenues in <4 months as a solopreneur 14 comments Use Your Product 13 comments