How to tweet from a local webpage - javascript

I made a webpage that I open in my browser that uses Javascript to help me construct what I want to send on twitter. Then I have to copy and paste the text into a Twitter client in order to actually send it.
I would like to just have a button that I press on my page that will send the tweet instead of doing this. Is it possible? I've been looking at jsOAuth and it seems I need things like a consumer key and secret? I don't have those things. This isn't a public app, it's just something I'm making for my own personal use.
How can this be done?

You can do this with a regular tweet button. You can provide the text that you want to tweet about. Normally you would think this is for public use, but I've found it very useful for an admin section. Here is the link to the twitter dev page:
https://dev.twitter.com/docs/tweet-button

AFAIK OAuth requires a site to redirect to, also for cookie purposes.
There is something called OAuth for devices that let's you authenticate the application instead of the browser/client. Facebook supports it, Iam not sure if twitter does it too.
hth

Related

HTML / JavaScript - Post message on facebook wall from my web

this question may sound stupid, but im getting frustrated from searching around, and i cant manage to do that:
I want to create a button on my web (not an applications if that matters), and when the user will click on it, it will post a dynamic message on his wall.
Do i have to use javascript SDK for it, or is there a simpler way?
Thanks!
You have to use Facebook Connect (Facebook SDK for Javascript).
Take a look at this:
https://developers.facebook.com/docs/javascript/quickstart/v2.2
But before use this API you need to create an APP ID in the Facebook developers page and use this ID to authenticate through OAuth:
https://developers.facebook.com/apps
This link also explains you how to use Facebook SDK with jQuery
https://developers.facebook.com/docs/javascript/howto/jquery
I hope it helps.
Edited:
If you want something really simple. You can use Social Plugins to allow the user share your website. But I'm not really sure if you want to post a custom message for the user.
https://developers.facebook.com/docs/plugins/share-button/

Take screenshot via PHP and Javascript

I have a chat system and I want to protect my users from malicious websites, and sometimes people sends a URL through the chat system, and users click on it and access some scam sites. I have that protect page like redirect.php?url=someurl.com that alerts the users that URL can be a malicious website, and the users have to click on Continue button to access the link. But I want to give them one more option which is See a preview, and clicking on it, a new tab will be opened with a screenshot, or if it's not possible only with PHP and Javascript, show a clean version of the page without Javascript.
How can I do this?
I'm planning of make use of file_get_contents(), save it to some preview text, cleaning the <script> tag of the page, but it'll be enough?
Lots of such screen capture web service here:
What's the best website screenshot capture API?
But instead of doing that by yourself, I think you should go with those many public link-shortening service, like t.co, because anti-malicious is already one of their purpose:
Having a link shortener protects users from malicious sites that
engage in spreading malware, phishing attacks, and other harmful
activity. A link converted by Twitter’s link service is checked
against a list of potentially dangerous sites. Users are warned with
the error message below when clicking on potentially harmful URLs.
Try this solution :): html2canvas
[outofdate] http://html2canvas.hertzen.com/screenshots.html
--
Update: http://html2canvas.hertzen.com

how to use Facebook share button in my web page to share or post something to facebook page?

i am added a facebook share button to my website it is sharing or posting things to profile timelines but it is not sharing or posting anything to my page(like fans page in facebook).Is there anyway to choose to post to your fan page? any one can help me? plz..
Considering whatever is the "things" in your website, say a product with id 123, for example.
You can make users like it/share it using the standard fb-like button.
When they do like it and/or share it, it comes up as a thing they liked on your website. If that object of yours, has a proper URL with proper meta-tags, it will show up nicely on FB as a story. Good guide here
You can also use the facebook debug tool for testing if the sharing, meta tags are all working as expected here.
If you want your page to be the object of sharing, the only thing that can be done is users can like your page from your website. You cannot share stories from the API to the page, as the page is not an entity. Meaning its not a user.
So, if the page said,
User XYZ liked item ABC on yourwebsite.com
it won't make much sense to the people who see this.
Instead if userXYZ liked an itemABC on your site, the following update on FB will make much more sense.
UserXYZ liked itemABC on yourwebsite.com
(This will have a proper pictorial representation and a clickable link to your website if the like button and the destination url are configured correctly)

Facebook how to create button that share content with 1 click?

I have seen on many websites who have a button. That share a story to yours facebook profile when you click on it. I have tried the Facebook Share button, but a dialog appears.
How do I create a Facebook share button that share content with only 1 click?
you need to use open graph api in Facebook or add meta tags in the <head> </head> of your pages, where your share button is placed.
look at this section, Sharing Rich Media
But you should use Like button instead, Share button is deprecated by Facebook.
Facebook has many restrictions concerning sharing content. There are a few roadblocks to one-click sharing.
What you tried used the Feed dialog, which is the easiest way to share content to a user's profile or timeline. However, this brings users to a Facebook.com url where they must approve the content and enter their own message. You can set certain parts of what is shared (URL, title, description, etc), however under most circumstances you may no longer set the message that is shared. See http://developers.facebook.com/docs/reference/dialogs/feed/ for more details.
On the other hand, you can use Facebook Auth to publish to a users stream using the publish_stream permission. However, this is an advanced technique that requires extra work on the part of the developer. You must create an application, allow the user to login, and request the publish_stream permission from the user. After gaining permission, publishing to their stream can be accomplished with 'one-click,' or by simply using using javascript or server-side code.
The simplest solution is obviously using the Feed dialog, which is two-clicks, but a whole lot easier than Authentication.

Facebook like button for a facebook status

I've pulled some facebook statusses to my website and I would like to add a like-button to them. I can't seem to use the facebook like button generator. When trowing a url like this:
http://www.facebook.com/permalink.php?story_fbid=268577716517595&id=224519707563955 in the facebook url linter tool it sais it can't crawl itself.
Is there a way to fix this like-button? A way of custom coding a facebook like button? or is the only solution to redirect to this url?(Not an great option, i want the user to stay on my website)
I hope anybody has a solution for this.
You can perform an like of an object through the Graph API, but then the user have to authenticate your application.
See more under the like section here.

Categories

Resources