I'm trying to develop a custom coupon system, and all works with IE, but when I try to use the following code on firefox or safari on click it open link and display alert but doesn't copy text:
<script type="text/javascript">
function copy_to_clipboard(text)
{
if(window.clipboardData)
{
window.clipboardData.setData('text',text);
}
else
{
}
alert('<?php echo get_option('custom_message'); ?> Powered by: WpCode.net Couponica');
return false;
}
</script>
And on the link:
<a onclick="copy_to_clipboard('code to copy')" href="link to open" style="margin-left:40px;" target="_blank">
What's wrong? How can I change this to make it work on firefox?