Recently, I had a question about creating a custom mailto share button that would open a window for users to enter email addresses they want to send to. While seeking advice on this matter (How to Create a Mailto Share Button that Opens a Window in which Ones Can Enter Email Address to Send to), user Ron Royston gave me a helpful response suggesting: "You could create a dedicated page to collect email addresses and process them server-side. Keep the popup small like this:
<a href="/my-email-collector-page"
onclick="window.open(this.href,'targetWindow',
'toolbar=no,
location=no,
status=no,
menubar=no,
scrollbars=yes,
resizable=yes,
width=200px,
height=120px');
return false;">email</a>"
This method seemed promising, but when I integrated it into my JavaScript code (available at CodePen here: https://codepen.io/IDCoder/full/rpdBQJ/), along with other social media share buttons, it somehow disabled those buttons. I am curious as to why this happened – could it be due to using
<a href="........"></a>
within a JavaScript environment? If so, how can I merge Ron's code with a click function like this:
$('.whatever classname').click(function() {
window.open();
});
In summary, starting with the line,
window.open(this.href,'targetWindow',....
how do I incorporate the following code: into the above script?
window.open(this.href,'targetWindow',
'toolbar=no,
location=no,
status=no,
menubar=no,
scrollbars=yes,
resizable=yes,
width=200px,
height=120px');
return false;