Skip to content

Instantly share code, notes, and snippets.

@coliff
Last active Oct 25, 2021
Embed
What would you like to do?
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