2
I want to create a share button to put on other sites, such as facebook, or twitter and for that I need that when I click the button save the url and send to my email, how do I do this?
2
I want to create a share button to put on other sites, such as facebook, or twitter and for that I need that when I click the button save the url and send to my email, how do I do this?
1
With this you can get the url
var url = window.location.href.toString();
Here is a simple example so that when the user clicks the button, open a window with the url. Making it possible to share (Ctrl+C)!
var copyBtn = document.getElementById('copyBtn');
copyBtn.addEventListener('click', function(event) {
/*Pega url*/
var url = window.location.href.toString();
/*seta para que a mesma possa ser compartilhada*/
window.prompt("Pressione: Ctrl+C, para compartilhar a url", url);
});
Button html
<button id="copyBtn">Salvar URL!</button>
Browser other questions tagged javascript html
You are not signed in. Login or sign up in order to post.
java != javascript (http://answall.com/revisions/80920/1)
– Guilherme Nascimento
Use relevant tags to doubt, read this link: http://answall.com/help/how-to-ask
– Guilherme Nascimento