const currentUrl = new URL(window.location.href); if(currentUrl.host == 'shop4d.com') { var roid = ""; var ronumber = ""; var usertype = "repairorder"; } else { var usertype = 'websitechat'; var pathname = encodeURIComponent(currentUrl.pathname); } var html = '
Chat with us!
'; document.body.insertAdjacentHTML('beforeend', html); let chatbutton = document.getElementById('shop4d-chat'); chatbutton.onclick = function(){ window.open('https://shop4d.com/common/chat.php?usertype=websitechat&cid=MTc5&meta='+currentUrl,'s4dchat',"popup,left=100,top=100,width=420,height=620") }