Can anyone help me or provide me a code that allows user to copy URL of the site. Usually, it's a button that you click and then the URL of the site is copied to your clipboard. php, javascript, or jquery will do. Thanks a bunch!!!
function copy(s) { if (window.clipboardData && clipboardData.setData) clipboardData.setData("Text", s); } <?php $url = (!empty($_SERVER['HTTPS'])) ? "https://".$_SERVER['SERVER_NAME'].$_SERVER['REQUEST_URI'] : "http://".$_SERVER['SERVER_NAME'].$_SERVER['REQUEST_URI']; ?> <div onclick="copy(<?php echo $url;?>)">Click to copy url</div> Thanks.