views:

61

answers:

2

I am implementing a content sharing service, similar to Twitter and Facebook button. When the user visits a page, he will be able to click on my button, which will open a page in a new window that lets the user interact with my service. My service use 2 parameters: the current page's URL and title.

I have looked at the html code used to add the Twitter, Facebook and Printfriendly buttons and they all use Javascript code specific to their service. For instance, this JS file must be included to add the Printfriendly button to your page:

<script src="http://cdn.printfriendly.com/printfriendly.js" type="text/javascript"></script>

For Facebook: <script src="http://static.ak.fbcdn.net/connect.php/js/FB.Share" type="text/javascript"></script>

Twitter:<script type="text/javascript" src="http://platform.twitter.com/widgets.js"&gt;&lt;/script&gt;

My question is do I need to write some Javascript code or can I just forward all the request to the server?

Thanks,

Olivier.

A: 

You need to write a bit of JavaScript code for the button (for the window to show up with the specified contents) and the main script (which is included like Twitter and facebook did as you mentioned)

alexy13
A: 

You can get away with simple hyperlink. For example Facebook share button works like hyperlink: <a href="http://www.facebook.com/share.php?u=http://www.shredsite.com/&amp;t=Title"&gt;Share on Facebook</a>. The reason to use javascript or iframe is to have better control over user experience. So it is up to you to decide how you want to handle it.

Denis