Expiring links to images in Facebook share? - javascript

We are implementing a facebook share dialog so users can share images from their accounts. Those images are hosted on S3 and we use expiring links to ensure that normally user images are only accessible to them.
The question is, if we provide that link to the facebook js library to create the share dialog, when the user posts, does facebook make a copy (where our link expiring 2min later is fine) or does that link have to remain available for longer or forever? If it does make a copy, is that when the user clicks the Post button? Or earlier when the preview is show in the dialog?

Following this link,
Share articles, photos, videos and other content as a URL that points
to the page where your content lives.
It seems facebook don't copy over image, it just keeps a reference.

Related

How can I collect survey responses through a Chrome Extension?

I want to make a browser plugin that works as follows:
The user enables the plugin. He then has a thumbs up and a thumbs down appear on the screen somewhere. If he clicks thumbs up, it means he likes the current web page he is viewing. If he clicks thumbs down, it means he doesn't — similar to how you vote on YouTube videos
The responses will be collected from many users to a website I setup
The plugin will allow people to see how many people voted a thumbs up and thumbs down for the current page they are viewing
Does anyone know how I am supposed to collect, aggregate, and return the values of the responses? Also, I would need to be able to know the ID of each user because I want to be able to perform future operations based on a user's past behavior. Can I avoid planting a cookie, in case they delete them, and have an ID that is stored in the extension's local files?
I'm sorry if this wasn't clear or if I should unpack it a bit more. I'm familiar with Wordpress, so a solution with that would be great.
From your requirements what i understand is For uniquely identifying a user, you can assign a Unique ID to a user who installs your Extension. For details look this answer https://stackoverflow.com/a/23854032/6428485
You can use content script to add Thumbs Up, and Thumbs Down icons in website. When user clicks thumbs up/down you can use background script of extension to send vote, UserID, and website URL through POST Request to your server to store.
You can collect votes from any user by above method and store it on your server.
Next time when any user visits that URL you can make a GET Request to your server and get number of likes and dislikes against that URL and display them on website using content script.
Hope this helps. Let me know if you need any clarification.

Grab a person's Facebook profile picture and embed it

When you embed a "like this page" button on your page, your profile picture and other people's profile pictures are shown. This requires no authentication, because it's all done through an iframe.
I want to place a placeholder on my site, but I want to spice it up, by adding their profile picture from Facebook instead. Obviously it would have to be in an iframe, because I don't want people to accept terms and stuff like that.
Is this doable? All I have seen requires their user id and so on, which I won't be able to get, as I technically don't handle any of their requests (it's all done client-side because of an iframe). Thanks.

How to share content dynamically from web site using javascript to facebook user wall?

Here is my requirement,
I have a website, which integrates with facebook.
Here I am fetching latest post (description and image) from company facebook page. I have added like, comment and share buttons.
I am using Grapth API calls to fetch the latest posts. Everything(calls) using javascript.
My Question, When a user clicks on Share button, share UI popup comes up with text field and image. But I want to share the description which has been retrieved earlier.
Is there any way to share description and image?
Thanks In Advance.
Khader.

Is there a better way to track a redirect page with google analytics?

We are putting out a press release that contains links to our website and to other websites.
Right now I have a redirect.php on my website that is redirecting the user based off the variable located in the URL (e.g. redirect.php?id=1) using a meta refresh. Google analytics is loaded on the redirect.php so I can capture that visit and see where visitors are coming from before we redirect them to their final destination (either an internal page or an external page).
I do not like having to wait for google analytics to load before the user can be redirected.
Is there a better solution for this?
Here's how I would to it...
Take a look at How to Track Downloads & Outbound Links in Google Analytics
You have two kinds of links you want to track:
Links to other sites.
Links to your own site.
The how-to above will explain setting up clicks on offsite links as google analytics events (this is a better way to treat this activity than as page views).
You can then use the same basic methodology to track the clicks to your own site from within the press releases. You'll just need to find a way to select them in jQuery. Maybe by the id of the div contains your press releases, maybe you'll need to add a special class to the links you want to track. It would depend on how your page is set up.

How does Twitter display my profile instantly?

Context
I realized that in Twitter, the profile page is displayed in different ways depending on how it is called:
By clicking the profile link in the menu, the DOM and the latest tweets are loaded, and the page is displayed in ~4 seconds. Each time.
Using the keyboard shortcut GP (or the link on the left), the page is displayed instantly.
Details
I noticed that the profile must have been recently displayed for GP instantly displays the page.
By closing and opening the browser, the profile must be displayed again for GP instantly displays the page.
Investigation
So at first I thought Twitter could use a serverside session variable to store data. Then I discovered a use of localStorage in the Twitter source code. I confess, DOM storage is unfamiliar to me and the Twitter JavaScript code is unreadable. So I don't sure they use localStorage to store the profile.
Question
Any hypothesis, infos or links about Twitter DOM storage / session storage?
This is an interesting question, so I went to twitter, and did some investigation myself.
Clicking on my profile name, the link is done with AJAX. I see my timeline getting downloaded. But, the page is already loaded in advance, so my information is also already downloaded.
By clicking on the link on the left, or with GP you just display the page already loaded (hidden, or in JavaScript object, so in memory). It will just display your profile already downloaded, and by AJAX download the feed (JSON).
The URL will change from https://twitter.com/#!/ to https://twitter.com/#!/wraldpyk (in my case).
When you click your profile in the menu (top right) you go to https://twitter.com/wraldpyk. This will re-open the page, and will download everything. Note you will get redirected to https://twitter.com/#!/wraldpyk, and meanwhile your timeline also gets downloaded (open FireBug and see the images and feeds getting downloaded)
As far as I can tell, no local storage (except in JavaScript, like everyone does) is done. All data is constantly downloaded on new page load.
Same thing happens when you type gh when on your profile. (And also with all other shortcuts)

Categories