How to get the url from a input field? - addthis

I recently develop a shortener URL script, now I'm trying to add Addthis buttons but the problem is that is sharing the current URL of the site is on. I want the Addthis buttons share the URL that is inside of the URL Input field anybody got some idea on how to do it?
Basically I want to add Addthis buttons and share the URL from a Input field that got the URL shorted .

The Real Question: How can you specify a custom URL for Addthis?
jQuery Solution
HTML
<a href="http://www.addthis.com/bookmark.php" class="addthis_button" id="youmusthaveanid">
jQuery
$('#youridhere').attr('addthis:url', $('#yourinput').val);
Note: Remember you will have to trigger this on every update of the text box if it's content changes after the Javascript has been run on initial load.
PHP Solution
HTML/PHP
<a href="http://www.addthis.com/bookmark.php" class="addthis_button" addthis:url="<?=$yourvariablehere?>"
Source: Addthis API Docs

Related

AddThis and History.js - automatic redirection to wrong URL

I have a problem with AddThis widget and History.js script.
Once user shares some page on Facebook using AddThis widget, some hashtag is appended to URL (e.g. #.U-S_Q-q0tE8.facebook).
Then, if user clicks such link on Facebook and goes to my website with URL e.g.: http://domain.com/path/to/content,123.html#.U-S_Q-q0tE8.facebook, they get redirected to http://domain.com/path/to/.U-S_Q-q0tE8.facebook which throws error 404.
The weird thing is that History.js is not even initialized or used. It's just embed on the site with <script...> tag.
Is there any solution to this? Is it possible to disable such behavior in History.js?
I have the exact same problem, and while I don't know if you can disable the history.js behavior, you can disable the addthis hashes by adding the following before the addthis script
<script type="text/javascript">
var addthis_config = {
data_track_clickback: false
}
</script>
This means you wont be able to track how many click that link gets using addthis, but something like Google Analytics is able to show traffic source.
Source

Creating a dynamic Facebook share button

I am stuck with this one...
I have a website that plays music. The page updates automatically to display the current song being played and the image of the artist. The website also allows visitors to request songs. What I want to do is allow users to then share their request on Facebook, so I have added the code below.
Initially, when you pressed the Facebook button, it would pop up iwth a box which contained all the correct info (song, artist, image, etc), but would not post correctly to Facebook (the dynamic info such as title and image would be missing). Now, recently, it doesn't even populate the pop up correctly.
I'm stuck and cannot figure out how to get this to work correctly, can anyone help me?
Thanks.
<a class="facebook" target="_blank" onclick="return !window.open(this.href, 'Facebook', 'width=640,height=300')" href="http://www.facebook.com/sharer.php?s=100&p[title]=I'm listening to <?php echo $currentSong->title . ' by ' . $currentSong->artist; ?>&p[summary]=Join me and listen right now or request your own song&p[url]=http://www.mydomain.com&p[images[0]=<?php echo $largeimg; ?>"><img src="http://www.mydomain.com/new/images/facebook.png" width="32" height="32" border="0" style="padding-top:5px; padding-right:4px "></a>
Actually, you should only add the URL as parameter (url encoded) to the sharer.php:
<img ... />
It automatically takes the Open Graph data from the shared URL, see this page: http://ogp.me/
I assume all the other parameters are deprecated, at least it did not work for me some months ago. The only thing you could try is to encode all data with the PHP function "urlencode" - but i would suggest using the correct way and implement Open Graph correctly. That way you can even just take the URL, put it on Facebook manually and it will take the correct data.
If the content is completely dynamic, you should consider using Open Graph Actions: https://developers.facebook.com/docs/opengraph/
Or if that is too complicated, use the FB.ui feed dialog:
https://developers.facebook.com/docs/reference/dialogs/feed/
...but don´t forget to include the JavaScript SDK:
https://developers.facebook.com/docs/javascript/quickstart

Facebook Send button does not show up on Gwt popup panel?

I'm trying to get Facebook send or like button display on GWT popup panel and I am not successful. When inspecting the generated HTML, facebook HTML button looks properly inserted into but it just does not show up. Save Facebook button works well in html page (not on GWT panel).
Have you ever had success in displaying Facebook Send or Like or Share button in GWT? I know I ca implement FB Like button myself using API or other libraries. But I do it need that. I need standard Facebook Send button to be used in my GWT application.
Please advise me if you have experience and were successful.
Thank you very much!
I had a similar problem, and it was because, in the html file's script tag, I had changed and not updated the src="path" to a valid path. I had a wrong directory listed in the path. For me, it's correct now with:
<script type="text/javascript" src="clienttest/clienttest.nocache.js"></script>
I rebuilt, and the image appeared on the page. This problem was keeping the entry point module from loading.

FB.provide is not a function

I'm developing a WordPress plugin to show above or bottom the posts Facebook like and send buttons.
Unfortunately when is also activated a plugin for Facebook share button there is a Javascript error (FB.provide is not a function) and like and send buttons don't appear.
For example this happens in this page: http://www.pasqualepuzio.it/2011/04/plugin-facebook-like-and-send-button/
How can I solve this issue?
Thank you very much
I ´ve faced the same problem and it happens if you add the script twice on the site (http://connect.facebook.net/sv_SE/all.js)
I understood that part that we cant have all.js twice but I want to have Facebook Share Button and Facebook Like Button.
According to Docs, I need to include these two JS Files.
https://connect.facebook.net/en_US/all.js
http://static.ak.fbcdn.net/connect.php/js/FB.Share
Now, If I include both Firebug will give me same error "FB.provide is not a function". If I remove either of them then Like or Share button wont work.
I can do iFrame version but I have HTML Encoding issues with iFrame Version. I am programmatic generating HTML Response.
Any idea, how to approach?
There is a workaround for this: instead of placing the javascript Fb.Share within the same page where you are loading the Javascript SDK, use an Iframe with the first and set it in the second.

Facebook - serverfbml form action must be within the application's connect url

I am not sure, I am using a pretty standard piece of code for facebook. It sends requests for people regarding my application. All of a sudden I am receiving this error:
serverfbml form action must be within
the application's connect url
Have you been having problems with using either one of these:
fb:serverFbml
fb:request-form
fb:req-choice
fb:multi-friend-selector
thank you!
I don't know if you managed to find a solution yet, but I will tell you what my solution is. The action attribute of your forms should NOT be relative URLs, that is you should give the full URL of the website where the application is hosted:
fb:editor action="http://www.mydomain.com/myapp/index.php?params=1" labelwidth="100"
Use the canvas URL under Facebook Integration section in your application's edit mode.
If your canvas URL looks like this:
http://www.example.com/myfacebookapp/
then, in server fbml form action, the URL MUST be in the same directory of your canvas, like this:
(using the example of
<fb:request-form action="http://www.example.com/myfacebookapp/somepage.html"
Also, if the whole contains blank spaces i.e.
http://www.example.com/myfacebookapp new/
consider eliminate that blanks, or use %20 instead of the blank when you specify the URL canvas on Facebook and when you use that URL in form
<fb:request-form action="http://www.example.com/myfacebookapp%20new/somepage.html"
I solved it finally.
Dont get messed up with all type of setting.
Simply go to your facebook app
click edit app button
now copy Canvas URL
and paste it under
<fb:request-form action="CANVAS URL HERE"
method="POST">
Well, it worked for me.!
Thanks to "tsegaye"
i had the same issue.. i used the canvas url in the summary page and it worked. You can try it out aswell
This is not the solution. If you do this, when user clicks "skip" on the dialog, he would be send to http://www.mydomain.com/myapp/index.php?params=1" instead of your application.
The solution is:
action="http://apps.facebook.com/myapp/" -> this "/" at the end would help.
It could be also any other action inside your app for example:
action="http://apps.facebook.com/myapp/sendRequest"
This solution works if you use friend selectors outside the scope of sending requests. For eg. Selecting friends to collaborate with in your app.
Not an answer but this is what helped me. I have a iframe based application and i tried to use the facebook iframe based friend invite code. In my action, i put the app.facebook.com/myapp/ url which whould be give me this fbml error
serverfbml form action must be within the application's connect url
Also when i pressed "skip" it would take me to a 404 error. The solution was to use the canvas url under facebook integration, as suggested by #tsegaye