Click here to Skip to main content
15,886,072 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
<html>
 <head>
  <script>
   function myFunction() {
   var x = document.URL;
   document.getElementById("currenting").src = 'https://www.facebook.com/plugins/share_button.php?href='+x+'&layout=button_count&size=large&mobile_iframe=true&width=83&height=28&appId';
  }
  </script>
</head>
 <body onload="myFunction()">
 <iframe id="currenting" src="" width="83" height="28" style="border:none;overflow:hidden" scrolling="no"  frameborder="0" allowTransparency="true"></iframe>
 </body>
</html>


What I have tried:

have tried to write share on facebook between share on facebook
but its not showing.i want where i can click when sharing

<iframe id="currenting" src="" width="83" height="28" style="border:none;overflow:hidden" scrolling="no"  frameborder="0" allowTransparency="true">share on facebook</iframe>


please help me.
Posted
Updated 28-Oct-21 21:13pm

1 solution

If you follow the link you are assigning to the iframe src you will see nothing but a blank screen. Therefore you see nothing on your html page.

You can generate Facebook share button by using this: https://developers.facebook.com/docs/plugins/share-button/[^]

Here is an example how to embed a generated share button:
HTML
<html>
<body>
	<iframe src="https://www.facebook.com/plugins/share_button.php?href=https%3A%2F%2Fdevelopers.facebook.com%2Fdocs%2Fplugins%2F&layout=button_count&size=small&width=96&height=20&appId" width="96" height="20" style="border:none;overflow:hidden" scrolling="no" frameborder="0" allowfullscreen="true" allow="autoplay; clipboard-write; encrypted-media; picture-in-picture; web-share"></iframe>
</body>
</html>
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900