Allow user to share website link to a specific group - javascript

I have this development requirement:
On a website there is a link. When user clicks the link - it opens window (popup tab or in-page form - whatever) that allows user to SHARE current webpage to a specific facebook place - preferably one, specific group.
Example, lets say we have a webpage "AstroStuff" about astronomy that allows people to add their texts or images. There is also one facebook group "Astrolovers" for people fancied with astronomy - but not necessarily readers of that page.
After user adds some text or image, webpage should say:
"Hey, you just added nice astronomy picture, why dont you share it to a facebook group Astrolovers?".
Something like this could pop up:
Is there any way for accomplishing that?

You could simply use the Send dialog with the group id put into the to parameter. https://developers.facebook.com/docs/sharing/reference/send-dialog
(The user will be able to remove the group and/or add other recipients – but that should not matter much, right?)

Related

Javascript Facebook post preview

I have 2 text fields, one for description, another for a link to be shared to Facebook (manually after review).
I want to show the user what their combination would look like, when I share it to Facebook.
I can simulate the post textbox as it is on Facebook (link below), but 1) when they change it, it will be out of date, 2) the URL will not be processed and shown as on FB.
Is there some easy way to show the user what the data will be rendered like, when I take it and post it on FB page?
Can be done any way (popup, iframe, etc... )
Without the possibility for sharing, for rendering I would support my Page info.
Which means for my user:
Fill in the description and url, when I share it on my page, it will look like this.
I found a similar question, but it did not cover rendering of the links Create a Facebook Post Preview
Does anyone have experiences in the area?
UPDATE:
For better understanding I drew pictures of the flow. On the first picture you can see 2 textboxes for the user. Here he enters description and a link. On the second picture his data, combined with my static data, are rendered just like it would be on Facebook, if I posted it via my page.
Picture 1 - User interface
Picture 2 - Result

How is this JavaScript working in an email received from Google

I received an email in my Gmail account from Google about people I might know on Google+ which contained running JavaScript with hover effects etc, at least I assume it was JavaScript, HTML5 maybe??... See below screenshot:
As you can see (kind of) is when I hovered over the ADD TO CIRCLES button, a new window slid open asking me to select a category for that person. When I ticked a category, it added a Tag with that category next to the persons name.
I have never seen an email with dynamic content like this, and I am guessing the obvious answer the email was from Google being displayed on they own email service so they can do what they like. But I would be interested in how they achieved this and could we take advantage of it in some way?

JavaScript Facebook share options

I have a task to make things with social networks.
As far as I have discovered, there are 2 options. One is through your News Feed and the other is through the Sharer. In the diagram below, I show both.
The first uses dialog/feed, and the second uses sharer.php.
There is a difference as to how content is shared. The first shares it how I would like it, the second shows it in a way that I dislike.
I do not like the fact that the second one shares the whole page. I want that share icon for every image in the page and to share that specific icon, but not the whole page. Is it possible to make the share icon to look like the second image, but share content like the first? How should it look in Javascript/HTML?
If you need any code, that I used, just ask.
For the second option to look like the first one - and to use a specific image - you have to use Open Graph tags in the shared URL: http://ogp.me/
The second option is made with the "sharer.php", i guess. It just takes the URL of the site as parameter, the rest of the information is loaded from the Open Graph tags in the page. You can also define more than one share icon btw, so the user can browse through them before sharing.
For example, if you want a specific image to show up, you need this tag:
<meta property="og:image" content="http://mydomain.com/myimage.jpg" />
Btw, you can always test the Open Graph tags in the Facebook debugger:
https://developers.facebook.com/tools/debug
It also refreshes the tags, if they don´t show up correctly in the share window, just put the link into the debugger again.

How to enter text into the "Write something..." box on Facebook and click Submit

I am trying to manipulate Facebook pages in various ways, using Javascript browser elements. I'd need to be able to insert some text into the top "Type something..." box that shows on my site's fan page (or alternately, "click into" the field and I can type the text using GUI scripting), then click the "submit" button as if i'd done it by hand. It's tricky since the page is very Ajax heavy and I can't find the names of the elements I need to manipulate, let alone how to manipulate them as they're not using traditional form fields I'm used to. Can anyone help me figure out how to do this with javascript commands, which I'd be calling from Applescript on the Mac?
Many thanks in advance.
UPDATE
Thanks for the comments below. Believe me, I am not trying to do anything spammy or douchy, mainly posting links to products that have gone live on page facebook page, but do it during the business day when people are on rather than at strange hours of the day. I am located in Japan so my sleep period is right when people are using FB.
The solution I came up with for clicking the button was got using UI Browser, an outstanding tool if you're trying to script on the Mac. The script that clicked the button for me was:
tell application "Safari"
activate
set thename to name of (get current tab of window 1)
delay 3
tell application "System Events"
tell process "Safari"
try
click button "Share" of group 1 of group 2 of list 3 of group 9 of UI element 1 of scroll area 1 of group 3 of window thename -- this one works on the mini?
on error
click button "Share" of group 1 of group 2 of list 3 of group 9 of UI element 1 of scroll area 1 of group 2 of window thename -- did not work
end try
end tell
end tell
end tell
Hope this is useful to anyone.
You can't. But even if you could you want to post comments on peoples behalf and expect them to continue using your site...
It would be cross site scripting - and since the comment box is in an iFrame it actually exists on Facebook's site and not your site.
Manipulating web pages for functionality is rarely a good idea, since you can introduce bugs and security flaws.
In this instance, if all you want to do is post a status, just use the Facebook API thats what its there for. They provide libraries (I think, at the very least they are available) to make it easy to use whatever language you want.
From a UX PoV, people don't like being forced to post things, so if this is just for your use, then fine, otherwise, make sure that people know whats going on. Its only polite.

Show user information on mousehover

On Mouse-over i wish to show user information such as User Id, User Name, User Location, User Age etc. All this info would be coming from database. As well, this information would be in a rectangular block that would actually come-up on Mouse-over.
I am aware that JavaScript could be use to show div (in mouse-over) but don't know how to fetch from database?
Plus the application is a Windows Based Asp.net Application. I am not aware whether that could be possible in Windows based as i'm web based developer.
Thanks for all your inputs.
You could use the jQuery qtip plugin that can display dynamic content, see a documentation at
http://craigsworks.com/projects/qtip/docs/tutorials/#dynamic
and a demo at
http://craigsworks.com/projects/qtip/demos/content/loading
The url parameter should point at an aspx page that show the text that is loaded from database.

Categories