Single comment thread
See full discussion

I know people do it with iframes, but like....how do I check that it's a paying customer (referral url?) and make sure that I can't get hacked, it's my real customer, etc. I'm just a n00b when it comes to this specific type of development

Ohh i made this on contactbox
Basically, iframes duuudes.
- The snippet I provide has two thing 1. it create a script that is called from my server. 2. it runs a function in the js on load with an ID parameter identifying the customer:

<script>
(function(b, o, x){var js, fjs = b.getElementsByTagName(o)[0];
if (b.getElementById(x)){return;}
js = b.createElement(o); js.id = x;
js.onload = function(){box("HJId52J7m")}
js.src = "https://contactbox.co/js/loader.js"
fjs.parentNode.insertBefore(js, fjs)
}(document, "script", "feedbackLoader"))
</script>

so the function box() called on load create the iframe for my widget. and use this iframe to send the customer ID (via postMessage.
On my website, i get the customer ID, verify it (using also the referrer url), get all customer info needed, and build the widget that is shown in the iframe.

Also since my widget size change, i have some event pushed thought the iframe to resize it.

roughly, its the idea, lmk if you want to take a look at the code

Home
Search
Messages
Notifications
More