Share a link with hash on Facebook sharer not possible - javascript

I need to share a link on Facebook, the link is like below:
http://mydomain.com/mypath#photos:para=a&para2=b
but without luck, the result is:
http://mydomain.com/mypath
which is not what I want, I try below link:
Using hash tags with Facebook share possible?
to replace the # with %23 but then it gives me:http://127.0.0.1/mypath?photos%3Apara=a which is obvious wrong.
Any idea about this? Thanks in advance.
BTW the facebook sharer link is:
https://www.facebook.com/sharer/sharer.php?u={0}

Facebook wont crawl the Javascript.
But as Facebook take the og tag into the account.
So you need to create pages alike your hash pages with different URL.
May be http://mydomain.com/mypath?para=a&para2=b
for : http://mydomain.com/mypath#photos:para=a&para2=b
And place only og metas in there, and redirect the page with Javascript. You may also put same data as in the hash page.
So Facebook will read the og tags. And if the link is clicked on Facebook than it will redirect after page load.
Thanks

Related

Short URL for whatsapp share

I want to share an article to WhatsApp. Its URL will be like this
www.mynewsportal.com/news/myarticle
When I share this,the above URL must change to the following format
mnp.com/myarticle
Also, if I click this link it must redirect to the original URL. Is that possible? Any help is appreciated.
Thanks in advance!!!
Well the short link is already in use so no, a redirect will not be possible in this case.
But you can specify the url you want to redirect the user to, in the data-href
<a href="whatsapp://send" data-text="Take a look at this awesome article:"
data-href="mnp.com/myarticle" class="wa_btn wa_btn_m" style="display:none">My
news portal - article</a>

Trace URL's that link to my iframe/widget

I have created a widget.html page with, for example, a "Powered by Example.com" box/widget. And I have an HTML iframe that links to that specific page (widget.html) on my site.
<iframe src="http://example.com/widget.html"></iframe>
I share that iframe code with website owners who want to use my widget on their sites.
I want to be able to see every single site that uses my iframe. I would prefer a code that creates a txt file or even a MySQL Table with all websites URLs that use my widget on their websites.
I basically want to track the sites that use my widget as an iframe . How do I do that? With Javascript? PHP? MySQL?
P.S. I'm not sure if an iframe is the best way to link widgets off my site, but I'm open for your suggestions. Thanks in advance.
use jquery
then load a request page throgh jquery like : $("#div1").load("demo_test.txt");
and send a request uri parameter to it
you will find the current url using the widget and alos you can get the parameter

Share on FB page showing image that I didnt included in my site

I am currently working on http://rightinfo.co.in
When I am trying to share this site on a FB page it is showing an image that I have not included in my site.
I have tried by adding ?v=1 to the url and url shortner services.
In facebook debugger also , the image is not showing. But in actual sharing , unknown image is showing.
Please help me to solve this
Thanks
You have issue with tags Please check this facebook debugger it explains alot Facebook debugger
It's because the og:image (see here) meta tag is set. This tag defines the image, which will be shown on facebook.
To change this image, try to edit this tag, take a look at the theme settings.
Another way is to change/delete the image itself, e.g. via FTP.
You can find it here: WEBROOT/wp-content/themes/Morpheus/img/portfolio/folio01-preview.jpg
Btw, I see you are using wordpress, I'd consider using a SEO plugin, which makes a proper use of the og-tags as explained here

Facebook sharer.php working unexpeted or not properly

I am using facebook sharer.php for share posts with images. But when i click on share button facebook sharer.php dialog showing with image and text that i have set. see image below:
After i click on share button. Post will be show on my facebook timeline. But there is no image with post. I think it is bug. below is my code
<a href="http://www.facebook.com/sharer.php?s= 100&p[title]=Title here&p[url]=http://example.com&p[images]
[0]=http://www.ucmas.com/wp-content/uploads/2013/07/rm.jpg&p[summary]=I love cheese" target="_blank">Share post</a>
You can test thing in this post fiddle also.
Facebook Sharer not showing image thumbnail
Any help?
Thanks a lot.
Have you tried running your site through the Facebook debugger? Not only will it show you what's wrong in 99% of cases, but it will also, every single time, clear facebook's cache of your page. Go here:
enter link description here
Enter your url, and see if there are any errors. My guess is that Facebook cached the fact that it couldn't find any image of yours, so simply doing that is likely to solve your problem. If not, your image is probably not publicly accessible.
Use faceboot meta tags.
`<meta property="og:image" content="http://davidwalsh.name/wp-content/themes/klass/img/facebooklogo.png"/>`
`<meta property="og:title" content="Facebook Open Graph META Tags"/>`
REF:
http://davidwalsh.name/facebook-meta-tags

Why doesn't this Facebook share code work?

I'm trying to make a custom Facebook share function for my website, and I'm using the Facebook sharer URL to open Facebook share in a popup window. However, for some reason it doesn't work.
What I'm doing is simple:
function shareFB(){
var img=$('#fb_img').html();
var text=$('#fb_share').html();
var url=$('#fb_url').html();
var full_url='http://www.facebook.com/sharer.php?s=100&p[title]=MyTitle&p[summary]='+text+'&p[url]='+url+'&&p[images][0]='+img;
window.open(full_url, 'sharer', 'toolbar=0,status=0,width=548,height=325');
}
The weird thing is, it doesn't matter what values I give to img, text and url or even if I use all of them. In the example below, I removed img completely and set text="whatever" and url="http://www.domain.com/stats_leagues.php".
https://www.facebook.com/sharer/sharer.php?s=100&amp%3Bp[title]=SportFant&amp%3Bp[summary]=whatever&amp%3Bp[url]=http%3A%2F%2Fwww.domain.com%2Fstats_leagues.php
Yet it doesn't work - it just opens an empty popup. Why? I've used the same URL format for Facebook shares a dozen times and it always worked. Even copy/pasting the formatted URL above into my browser just opens a blank page.
I don't know from where you got all those parameters, like s=, p[title], etc., probably from some old version of facebook share?
On Facebook share button docs, under FAQ, it says:
Yes, although we recommend using the Share button to offer the simplest and most consistent experience for people using your site, you can invoke the Share Dialog using a link: <a href="https://www.facebook.com/sharer/sharer.php?u=https%3A%2F%2Fparse.com" target="_blank">
So just change your code to:
function shareFB() {
var url = $('#fb_url').html(); #encode url if it is not already
var full_url = 'http://www.facebook.com/sharer.php?u='+url;
window.open(full_url, 'sharer', 'toolbar=0,status=0,width=548,height=325');
}
FAQ also states that Facebook will scrape your page for additional info, like title, image, etc. It scrapes your OG meta tags from your page. Debug it here.

Categories

Resources