Javascript examples for Browser Object Model:Window open
Open new window and set new url
<html> <head> <meta name="viewport" content="width=device-width, initial-scale=1"> </head> <body> <a href="#" onclick="javascript:share();"> <span>Share on Facebook</span> </a> <script> function share() {/*from ww w .j a v a 2s . c om*/ window.open( "https://www.facebook.com/sharer/sharer.php?u="+encodeURIComponent(location.href), "facebooksharedialog", "width=626,height=436"); return false; } </script> </body> </html>