Skip to content

Instantly share code, notes, and snippets.

@coliff
Last active October 25, 2021 09:32
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save coliff/fe18a182c8224d8d92ae1c31a31d756f to your computer and use it in GitHub Desktop.
Save coliff/fe18a182c8224d8d92ae1c31a31d756f to your computer and use it in GitHub Desktop.
freshdesk-messaging-facade with legacy browser fallback
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="x-ua-compatible" content="ie=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Freshdesk Messaging (formerly Freshchat) Facade</title>
<link rel="stylesheet" href="css/freshdesk-messaging-facade.min.css">
<script src="js/freshdesk-messaging-facade.min.js" type="module" async></script>
</head>
<body>
<freshdesk-messaging-facade id="freshdesk-messaging-facade" data-token="" data-siteid="example.com" hidden>
<div class="freshdesk-messaging-icon" tabindex="0" role="button"></div>
</freshdesk-messaging-facade>
<script nomodule>
function initFreshChat() {
window.fcWidget.init({
token: "",
host: "https://wchat.freshchat.com",
siteId: "example.com",
config: {
headerProperty: {
hideChatButton: false,
},
},
});
}
function initialize(i, t) {
var e;
i.getElementById(t)
? initFreshChat()
: (((e = i.createElement("script")).id = t), (e.async = !0), (e.src = "https://wchat.freshchat.com/js/widget.js"), (e.onload = initFreshChat), i.head.appendChild(e));
}
function initiateCall() {
initialize(document, "freshchat-js-sdk");
}
window.addEventListener ? window.addEventListener("load", initiateCall, !1) : window.attachEvent("load", initiateCall, !1);
</script>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment