I’m working on an app that needs users to add an embed code into their websites. The app lets users create numerous popups. These popups will appear for individual users based on different criteria.
Here’s how it functions: website owners insert a specific piece of iframe or JavaScript code on their sites to display popups.
One challenge I’m facing is generating distinct iframe or JavaScript code for each website that uses my app.
They both need exclusive iframe or JavaScript codes. These codes will be added to their websites, and the popups will appear from their respective accounts on Bubble.
It seems generating unique iframes or javascript embed codes might be a limitation of Bubble. If you have any insights or workarounds, I’d greatly appreciate your input.
There is a javascript library which automatically resizes the iframe on the page. you need to insert some code in your bubble app as well as in your page where the iframe is displayed.
Appreciate your response @daviddr17
Before I get to resizing the iframe, I needed help on creating a unique iframe for every website that registered on my app.
Well the simple answer is that you do that with dynamic expressions. I have a chatbot that can be embedded in site, I just dynamically specify the chatbot URL. But maybe there’s some auto-generating method I’m not aware of.
I used this to place it like a chatbot in the right bottom: <iframe src="https://your.domain.com/page_name/Current page's User's Slug" style="position:fixed;bottom:0px;right:0px;width:220px;height:270px;z-index:10000;border:none;margin:0 20px 20px 0;"></iframe>
From within the iFrame you would likely have to monitor the document or window global objects (the url that the user is in … these objects have parameters for this) in the DOM. You will need to run javascript for this.
Then you’ll find this project pretty hard so will want to learn some code skills or consider revising your project. Nobody’s going to be able to do it for free because it’s not straight forward