How does Facebook "like" button work? How to implement a plugin like it? [closed] - javascript

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 8 years ago.
Improve this question
Say I have a Facebook-like website with a high volume of traffic. Now I want to implement something like a Facebook "Like" plugin(?) for my site that other websites can use on their site. Let's call it "Hooray". How do I exactly implement one?
Or how does Facebook, Pinterest, etc. generally do it?

To implement your "Hooray" button you need to have components mentioned below:
A web service which will consumed by the client SDK to report that someone has ""Hoorayed" the post etc.
You need to have a database where you can store who "hoorayed" what.
You can consider every entry as a post or say "Hurricane".
Now every post is unique so you can identify who "Hoorayed" what.
Create a web service which tells the user who "Hoorayed" what.
Create a client SDK. It could be a JS library for web applications or Objective C framework for iOS etc. These client libraries will consume web services which are mentioned above.
Just like FB you will have to ask the consumer of your "Hooray" service to register an app on your platform. You can generate an appid for them and then all the data can be tagged with that.
Obviously these are just pointers and you can create a much sophisticated workflow based on your needs.

If you go on the Facebook developers page, you can access the code for a Facebook "like" plugin in multiple languages and try to figure it out from there.

Related

How do I make a web app with Google APIs? [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 10 months ago.
Improve this question
I am pretty new to web dev, and I wanted to create a simple UI in Javascript with the Google Maps Places API to familiarize myself with everything. My question is, would I just make direct URL requests with the user’s variables, or would I have to create something server side, and if so, what would I have to do?
It depends on your application's functionality. Generally, you could keep all everything on the client-side. If you app is a server-rendered one, meaning you would be using a JavaScript framework like React or Vue, you could use just the website state to keep track of users' variables and send out requests to the Google APIs to do the heavy work.
You could also look into tools like Firebase, also created by the folks at Google to handle storage or user authentication. There are rich docs on how to include Firebase in your web application for your framework of choice. This way you can create language-agnostic backend resources that conform to all of the security measures and scales automatically so you can focus on the users' experience.
In case you would like to offer some less-common functionality or have complete control over the backend you could write up an API of your own and have it deployed on a separate backend server.

How to make a working login functions for my website? [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed last year.
Improve this question
I am just entered this game since last December. Now I finished HTML CSS and a little bit of Java Script yet I got stuck at this stage: I can do basic styling but I don't know how to make it interactive.
So my question is :
how can I make a login function for websites, which can gives visitor an account (sign up, login, forgot password) that can do basic things like comment , add to basket and favorite a product?
Don't need to be specific, please just highlight which language is involved in which stage.
Thanks ahead.
Now I finished HTML CSS and a little bit of Java Script
So your site is what is called a static website.
If you want to allow login and data storing, you need a dynamic website, that requires one of this technologies:
PHP
ASP (check also ASP.NET)
Node.js (with express or http module)
Django (Python's library)
A few others...
All this technologies are called server-side languages/technologies, and the most used for long years has been PHP, that now has some strong rivals in terms of usage.
You can use only html/js to create a website. But, if you need authentication, post comments, a server side is needed.
A js can call easely an API to authenticate (server side) and post comments with XHR. You have to create it. You need to know how Authentication headers works for server side. You need to have a database (sql, file or nosql, it's your choice) to save the users datas and rights.

Implementing a live chat system in Website [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 6 years ago.
Improve this question
I would like to add a live chat support channel in my website, mainly focused on new users who have specific questions about my services and i´be been thinking about the best way to implement this solution myself. do note that i do not intend to use third party solutions.
What i´ve thought about retrieving messages: i can have a form on the page that will activate on user click (like a "start chat" button), once the button is clicked, i will GET all messages in the database related to the client's IP address (if it's not a logged in user) through a web service and load it into the DOM. after this, i will have a javascript function that will execute every XX seconds asking whether there are new messages.
to send messages: the user will have a textArea with a "send" button that will trigger a POST to a web service in order to save their message into the database, on the Support/web admin side, everything will work in a similar fashion but with the option of having several chats at the same time. Also i think I can achieve this by using JQUERY and ajax requests.
Is this a good idea to implement a live chat services? or am I far off from the ideal way of doing this? I have browsed around and all i get is suggestions to use third party service which i definitely do not want to use. Thanks!
You should have a look at websockets, especially at the socket.io library, which provides you an event based communication between the clients and the server.
They even have an example how to create a live chat:
http://socket.io/get-started/chat/
I you want a chat that is not just a "proof of concept", you should go for using XMPP, it's the most popular (and maybe the only-one) opensource instant-messaging protocol. There are several implementations in multiple languages and it has proven its robustness.
Wikipedia :
Extensible Messaging and Presence Protocol (XMPP) is a communications protocol for message-oriented middleware based on XML (Extensible Markup Language). It enables the near-real-time exchange of structured yet extensible data between any two or more network entities.
source
You could also take a look at IRC, which is quite old but still useful.

Google Analytics in my dashboard, users able to see their own analytics [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 6 years ago.
Improve this question
Hey I was wondering if someone would know a solution to my problem connected with google analytics.
I would like to embed google analytics into my dashboard and allow anyone to "connect" to those analytics with his own api key or some different authentication, which would then serve as a connection to his page where google analytics script is and show those in my dashboard.
So basically I just need a simple way to fetch data from different pages with simple authentication. I can then handle that data with different graphs, piecharts or just use native google ones. I was already thinking about iframe with google analytics inside my dashboard but that solution seems kinda hacky and I wouldn't be able to show different data in the way I want. I would like a simple interface for user to just put a key or his username/pass to log in and see analytics from his page. Hopefully I made myself clear.
Currently I found only this: https://developers.google.com/analytics/devguides/reporting/embed/v1/getting-started, which requires user to create Client ID through some google developers - https://developers.google.com/api-client-library/javascript/start/start-js#get-access-keys-for-your-application.
Sounds really complicated and I want just "copy" of google analytics page for my own project where users can put credentials and then see data alongside other things from my project. Project is basically some kind of CRM platform.
If anyone knows solution, it would be really appreciated.
If I understand correctly, you want to achieve the following:
Get GA data per user
Apply custom presentation to the data
Control access and authentication yourself
To achieve all this you will need to build your own solution (e.g. a web page) which gets the data from GA using the API. Start here: https://developers.google.com/analytics/devguides/reporting/core/v3/reference#q_summary

Best way to develop a group chat room [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 9 years ago.
Improve this question
I'm on developing a new application. It is going to work as follows,
=> All the user will be assigned to a group.
=> When a user logs in, the home page will show a textarea to add a message with all messages of the users who are in that group
=> Somtimes it is possible for one user will be assigned with more than one group, in that case the user have to select the groups they want to share their message.
=> The message sometimes have images and videos as well
In other words a chat room which is almost like the facebook newsfeed.
Now, my question, is there any plugins or script which is easy to be customised. Flash, Javascript.
Or what I can do is send ajax request every second to check the database for new message, grab and fetch on the screen. But the only thing I'm afraid is will it makes the server and/or the app slow or dead.
Please suggest me good solution dear genius brothers.
There are no such scripts to create an chatgroup that easy, you can use ajax to fetch the messages if you like.
But websockets or Server sent events would be a much better idea.
However using Server sent events (SSE) on apache is also not really a good idea as apache will create a proces for each open connection. If you would like to use SSE I suggest using nginx
Link to SSE.
https://developer.mozilla.org/en-US/docs/Web/API/Server-sent_events/Using_server-sent_events#Error_handling
Websockets.
https://developer.mozilla.org/en-US/docs/Web/API/WebSockets_API
Well learn:
jquery
nodejs
And then come back with other questions.
If you can learn, then learn the following:
Node.js
Angular.js
Socket.io
Express.js
They can make your life easier and this app can be possible in minutes. Look for a demo on the angular site.

Categories