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?
In your browser, type: plus.google.com and sign up with your Google account.
You just need to type in short URLs like “google.com/+techwalls” or “plus.google.com/+tuando” to reach those pages. Google Plus launches vanity URLs for verified accounts.
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>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With