Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6134403
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T17:21:03+00:00 2026-05-23T17:21:03+00:00

I’m developing a modal/popup system for my users to embed in their sites, along

  • 0

I’m developing a modal/popup system for my users to embed in their sites, along the lines of what KissInsights and Hello Bar (example here and here) do.

What is the best practice for architecting services like this? It looks like users embed a bit of JS but that code then inserts additional script tag.

I’m wondering how it communicates with the web service to get the user’s content, etc.

TIA

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-23T17:21:04+00:00Added an answer on May 23, 2026 at 5:21 pm

    You’re right that usually it’s simply a script that the customer embeds on their website. However, what comes after that is a bit more complicated matter.

    1. Embed a script

    The first step as said is to have a script on the target page.

    Essentially this script is just a piece of JavaScript code. It’s pretty similar to what you’d have on your own page.

    This script should generate the content on the customer’s page that you wish to display.

    However, there are some things you need to take into account:

    • You can’t use any libraries (or if you do, be very careful what you use): These may conflict with what is already on the page, and break the customer’s site. You don’t want to do that.
    • Never override anything, as overriding may break the customer’s site: This includes event listeners, native object properties, whatever. For example, always use addEventListener or addEvent with events, because these allow you to have multiple listeners
    • You can’t trust any styles: All styles of HTML elements you create must be inlined, because the customer’s website may have its own CSS styling for them.
    • You can’t add any CSS rules of your own: These may again break the customer’s site.

    These rules apply to any script or content you run directly on the customer site. If you create an iframe and display your content there, you can ignore these rules in any content that is inside the frame.

    2. Process script on your server

    Your embeddable script should usually be generated by a script on your server. This allows you to include logic such as choosing what to display based on parameters, or data from your application’s database.

    This can be written in any language you like.

    Typically your script URL should include some kind of an identifier so that you know what to display. For example, you can use the ID to tell which customer’s site it is or other things like that.

    If your application requires users to log in, you can process this just like normal. The fact the server-side script is being called by the other website makes no difference.

    Communication between the embedded script and your server or frames

    There are a few tricks to this as well.

    As you may know, XMLHttpRequest does not work across different domains, so you can’t use that.

    The simplest way to send data over from the other site would be to use an iframe and have the user submit a form inside the iframe (or run an XMLHttpRequest inside the frame, since the iframe’s content resides on your own server so there is no cross domain communication)

    If your embedded script displays content in an iframe dialog, you may need to be able to tell the script embedded on the customer site when to close the iframe. This can be achieved for example by using window.postMessage

    For postMessage, see http://ejohn.org/blog/cross-window-messaging/

    For cross-domain communication, see http://softwareas.com/cross-domain-communication-with-iframes

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

link Im having trouble converting the html entites into html characters, (&# 8217;) i
I have a string like this: La Torre Eiffel paragonata all’Everest What PHP function
Specifically, suppose I start with the string string =hello \'i am \' me And
I'm parsing an RSS feed that has an ’ in it. SimpleXML turns this
i got an object with contents of html markup in it, for example: string
I'm working with an upstream system that sometimes sends me text destined for HTML/XML
That's pretty much it. I'm using Nokogiri to scrape a web page what has
I have just tried to save a simple *.rtf file with some websites and
I want to count how many characters a certain string has in PHP, but
I would like to count the length of a string with PHP. The string

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.