Is it possible to crate SHARE link for specific page in my website? For instance:
http://www.MY-SITE.COM/index.php?page=show_book&book_id=$book_id
I tried:
<a title='Share on Facebook'
href='http://www.facebook.com/sharer.php?u=http://www.MY-SITE.COM/index.php?page=show_book&book_id=$book_id'
target='_blank'>
Share on Facebook
</a>
but it doesn't get the parameters.
If the parameters are getting stripped, try url encoding them (rawurlencode() in PHP).
Also make sure your target share page is serving up different open graph meta tags based on the parameters.
Share button is old. FB recommends to use the like-Button
http://developers.facebook.com/docs/reference/plugins/like/
looks like you need to echo your $book_id:
<a title='Share on Facebook'
href='http://www.facebook.com/sharer.php?u=http://www.MY-SITE.COM/index.php?page=show_book&book_id=<?php echo $book_id ?>'
target='_blank'>
Share on Facebook
</a>
A common approach to this, which will work amongst other providers too (twitter, g+ etc) is to use a url shortening service like http://bit.ly.
replace & with %26 something like
$url = 'http://www.MY-SITE.COM/index.php?page=show_book%26book_id='.$book_id;
<a title="Share on Facebook"
href="http://www.facebook.com/sharer.php?u=<?=$url?>">Share on Facebook</a>
Related
This is my implementation of tweet button
<a href="https://twitter.com/share?url=generated_url"
class="twitter-share-button"
data-text="Hi, you can see my presentation on this link">Tweet
</a>
There is something like list of presentations and every one has tweet button and itself generated url to share.
It working well, post tweet like I want - text and url. But, when I tweet via this button, link on twitter is unclickable. What is wrong?
EDIT:
unclickable - showed as plain text, example screenshot:
The code is correct, but the links with "localhost" are not clickable.
I had the same problem until I tested with a "live/public" link.
Your generated_url should not contain localhost, but http ://www . yoursite . com / data
I think this page on the twitter dev docs and this question can help a lot. For what i found there, it would be something like this:
<a href="https://twitter.com/share"
class="twitter-share-button"
data-lang="en"
data-url="http://this.url.com/foo/bar">Tweet</a>
<script>!function(d,s,id){var js,fjs=d.getElementsByTagName(s)[0];if(!d.getElementById(id)){js=d.createElement(s);js.id=id;js.src="https://platform.twitter.com/widgets.js";fjs.parentNode.insertBefore(js,fjs);}}(document,"script","twitter-wjs");</script>
I use Google+ to share some links on my page and there is a problem when I try to share an URL containing parameters. Example:
http://google.com?n=somethink&link=p/1393007&i=images/icons/gplus-16.png
When you put this URL into the field at this page:
https://developers.google.com/+/plugins/share/
...and click on the share button, you can't see information about page like name, picture and description. But when you delete the dot before "png", then Google shows data about the page.
The same thing happens when you write the ' symbol anywhere in the URL. I can't find any information about this error in Google Help Pages. It works when I use an URL like this:
http://google.com?n='&link=p/1393007&i=images/icons/gplus-16.png
...but it isn't very elegant solution.
How to write clean URLs?
currently G+ share supports only two parameters: url, for the target url, and hl, for a language code.
https://plus.google.com/share?url=http://www.stackoverflow.com
Alternatively, you can add OpenGraph tags to the head of your page to specify the same fields like this: (haven't tested yet)
<meta property="og:title" content="..."/>
<meta property="og:image" content="..."/>
<meta property="og:description" content="..."/>
Make sure you URL encode the link you want to share on Google+ via the Google+ share link.
For example: if you want to share the link http://example.com?a=b&c=d, first URL encode the link to look like:
http%3A%2F%2Fexample.com%3Fa%3Db%26c%3Dd
Now you can share the link on Google+ through the share link:
https://plus.google.com/share?url=http%3A%2F%2Fexample.com%3Fa%3Db%26c%3Dd
function googleplusbtn(url) {
sharelink = "https://plus.google.com/share?url="+url;
newwindow=window.open(sharelink,'name','height=400,width=600');
if (window.focus) {newwindow.focus()}
return false;
}
var url="www.google.com";
googleplusbtn(url);
Refer this link
The share link is intended for native client applications, Flash applications, highly privacy-sensitive sites, and others who may not be able to use the +1 or share button. Adding the following markup to your site will include a simple icon which will pop open a share dialog for your visitors.
<a href="https://plus.google.com/share?url=https://stackoverflow.com/questions/11868291/google-plus-share-and-parameters-in-url" onclick="javascript:window.open(this.href,
'', 'menubar=no,toolbar=no,resizable=yes,scrollbars=yes,height=600,width=600');return false;"><img
src="https://www.gstatic.com/images/icons/gplus-64.png" alt="Share on Google+"/></a>
The answer is very poor. You should use api for login then share content.
require_once 'google-api-php-client-master/src/Google/Client.php';
$client = new Google_Client();
$client->setClientId('YOUR_CLIENT_ID');
$client->setClientSecret('YOUR_CLIENT_SECRET');
$client->setRedirectUri('YOUR_REDIRECT_URI');
$plus = new Google_PlusService($client);
$authUrl = $client->createAuthUrl();
$visibleActions = array(
'http://schema.org/AddAction',
'http://schema.org/ReviewAction');
$authUrl .= '&request_visible_actions=' .
urlencode(implode(' ', $visibleActions));
print 'Sign in with Google';
I'm trying to generate a share URL with get parameters and it's doing some double encoding shenanigans.
<a href="http://www.facebook.com/share.php?u=http%3A%2F%2Fwww.bing.com%2Fsearch%3Fq%3Dkeyword" />
produces an error url while
<a href="http://www.facebook.com/share.php?u=http%3A%2F%2Fwww.bing.com" />
is fine. Anyone have ideas?
Facebook share link needed to be cached on their side. This has since be resolved on facebooks end.
I am looking for a way to code a link to open an instant messaging program. I have found the ways to open aim and yahoo chat, but not Jabber. Any ideas?
AIM: <a href='aim:goim?screenname=foo'>foo</a>
Yahoo Chat: <a href='ymsgr:chat?foo'>foo</a>
Use xmpp:alice#example.com?message - obviously you have to replace the address.
See http://xmpp.org/extensions/xep-0032.html for details.
According to RFC, Jabber link should be xmpp:my#jid.tld
I tried to insert the following snippet in my script. By clicking the link it should do a call to a Skype account. I've been looking for hours now, but can't figure out why it doesn't work.
<pre><code><a href="callTo://USERNAME"><img src="http://goodies.skype.com/graphics/skypeme_btn_small_green.gif" border=0></a></code></pre>
Is it accepted in any way or do I miss something here?
Try "callto" (with no uppercase letters).
Link will initiate Skype to call my number!
<a href="skype:********?call">Link will initiate Skype
to call my Skype username!</a>
source: http://geek.michaelgrace.org/2010/03/create-html-link-that-starts-a-skype-call/
I have been fighting with the following link all day.
Start chat
The problem that I had was with the USERNAME part
Finally, I just solved it.
My name on Skype web page was name but the real name was name lastname. The link in my web page did make Skype to load in my Android phone but, Skype failed to find the account to wich I wanted to call (name lastname).
I tryed, and failed:
<a href="skype:name lastname?call">...
<a href="skype:name+lastname?call">...
<a href="skype:name%20lastname?call">...
<a href="skype:name-lastname?call">...
<a href="skype:name_lastname?call">...
<a href="skype:phonenumber?call">...
Then, the solution:
<a href="skype:live:emailnamewithoutdomain?call">...
I just hope u find it usefull.
And, do not forget that u have a plenty of commands to add after the ? in the url (add,call,chat,and so on).
Just for another option from their official website:
https://www.skype.com/en/developer/create-contactme-buttons
It's nice and easy to use, can be used both for chat or/and call.