Home > Backend Development > PHP Tutorial > javascript - How to achieve this effect?

javascript - How to achieve this effect?

WBOY
Release: 2016-07-06 13:52:43
Original
854 people have browsed it

Many websites have such a third-party login function. Click to log in and a small window will pop up. After confirming on the small window, it will be closed immediately and the avatar on the main page will be loaded. Came out,. ,,How is this achieved? Partial refresh must involve ajax, but the address in the small window in the picture is completely a third-party interface. How can I use ajax to control and return information to the main page?
javascript - How to achieve this effect?

Reply content:

Many websites have such a third-party login function. Click to log in and a small window will pop up. After confirming on the small window, it will be closed immediately and the avatar on the main page will be loaded. Came out,. ,,How is this achieved? Partial refresh must involve ajax, but the address in the small window in the picture is completely a third-party interface. How can I use ajax to control and return information to the main page?
javascript - How to achieve this effect?

The poster can take a look at the oauth login authorization, https://segmentfault.com/a/1190000005177874 The poster can study this code

https://adodson.com/hello.js/

I have tried to write js for user authorization and briefly talk about the front-end aspect

This is usually the case
When the user triggers login, the program will detect whether there is a login token in the local storage, and a pop-up window will pop up or jump to our login page, which will bring some information such as application id and callback address. , after successful login, it will jump to the address specified by the callback, which is usually the original login page. When jumping to the new page at this time, the token will be brought. At this time, you can use this token to access other APIs, such as user information, friends, etc.

http://www.uyan.cc/getcode This kind of thing, just get a third party

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template