pull-icon
logo-mobile

Embedding Chat on your website (Guest sites)

Home/Forums/Embedding Chat on your website (Guest sites)

Bronze Member
Bronze Member

EmmaS

yesterday

SCS Chat fully supports guest-only websites where users are not required to register or log in.
With this setup:
Visitors choose a display name before entering chat
Names can be remembered on the device
No accounts, logins, or databases are required

How it works (in simple terms)
A visitor opens the chat page
They are asked to enter a name
That name is passed to SCS Chat as their username
Optionally, the name can be remembered for future visits

Guest chat embed code
Replace YOUR-CHAT-KEY with the chat key from your SCS dashboard.
<script>
  const params = new URLSearchParams(window.location.search);
  const guest = params.get("guest") || "Guest";
  window.SCS_CHAT = {
    key: "YOUR-CHAT-KEY",
    room: "thelobby",
    username: guest,
    title: "Lobby",
    mode: "guests"
  };
</script>
<script src="https://chat.streamcodestudio.com/embed.js"></script>

What this does
Reads the guest name from the page URL (?guest=Username)
Falls back to Guest if no name is set
Tells SCS Chat this is a guest-only room using mode: "guests"

Guest name prompt (popup overlay)
This optional script prompts visitors to enter a name before joining chat.
Features:
Simple name input
Auto-generates a guest name if left blank
Optional “remember my name” option
No cookies required (uses localStorage)
Add this below the embed code above:

<script>
(function () {

  const params = new URLSearchParams(window.location.search);

  // If a guest name is already present, continue
  if (params.get("guest")) return;

  // Reuse previously saved guest name
  const remembered = localStorage.getItem("scs_guest_name");
  if (remembered) {
    params.set("guest", remembered);
    window.location.search = params.toString();
    return;
  }

  const overlay = document.createElement("div");
  overlay.style.cssText = `
    position:fixed;
    inset:0;
    background:rgba(0,0,0,.55);
    display:flex;
    align-items:center;
    justify-content:center;
    z-index:9999;
    font-family:Arial,sans-serif;
  `;

  overlay.innerHTML = `
    <div style="
      background:#fff;
      padding:22px;
      width:320px;
      border-radius:14px;
      box-shadow:0 20px 50px rgba(0,0,0,.35);
    ">
      <h3 style="margin:0 0 6px;font-size:18px;">Enter your name</h3>
      <p style="margin:0 0 12px;font-size:11px;font-style:italic;color:#6b7280;">
        Guest access is available on non-membership websites.
      </p>

      <input id="scsName"
        type="text"
        placeholder="Your name"
        maxlength="20"
        style="
          width:100%;
          padding:10px;
          font-size:14px;
          border:1px solid #d1d5db;
          border-radius:8px;
        ">

      <label style="
        display:flex;
        align-items:center;
        gap:8px;
        margin:12px 0;
        font-size:12px;
        color:#374151;
      ">
        <input type="checkbox" id="rememberName">
        Remember my name on this device
      </label>

      <button style="
        width:100%;
        padding:10px;
        background:#2563eb;
        color:#fff;
        border:none;
        border-radius:8px;
        font-size:14px;
        cursor:pointer;
      ">
        Enter Chat
      </button>
    </div>
  `;

  document.body.appendChild(overlay);

  overlay.querySelector("button").onclick = () => {
    let name = overlay.querySelector("#scsName").value.trim();
    const remember = overlay.querySelector("#rememberName").checked;

    if (!name) {
      name = "Guest" + Math.floor(1000 + Math.random() * 9000);
    }

    if (remember) {
      localStorage.setItem("scs_guest_name", name);
    }

    params.set("guest", name);
    window.location.search = params.toString();
  };

})();
</script>

Notes & recommendations
No database needed - perfect for static or simple websites
Guest names are limited to 20 characters for safety
Remembered names are stored locally on the device only
Moderation tools (mute, kick, ban) still work as normal

When to use guest mode
Guest chatrooms are ideal for:
Radio station websites
Community portals
Event pages
Temporary or promotional sites

Leave a Comment

You must be logged in to post a reply.

Thank you ??

Thanks for supporting this station!

We've sent a download link to your email {}
Please check your inbox (and spam folder just in case).
The link will be valid for 24 hours.



BellOnline offers fast, reliable UK hosting with strong security and excellent uptime - perfect for modern radio and web projects.
MixStream provides broadcast-grade streaming with crystal-clear audio and rock-solid stability, ideal for both hobby and professional stations.

Goto BellOnline Now!

Close