[go: up one dir, main page]

CN112100536A - A web page access method, apparatus, device and readable storage medium - Google Patents

A web page access method, apparatus, device and readable storage medium Download PDF

Info

Publication number
CN112100536A
CN112100536A CN202010996716.7A CN202010996716A CN112100536A CN 112100536 A CN112100536 A CN 112100536A CN 202010996716 A CN202010996716 A CN 202010996716A CN 112100536 A CN112100536 A CN 112100536A
Authority
CN
China
Prior art keywords
target
server
web page
url
token
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Withdrawn
Application number
CN202010996716.7A
Other languages
Chinese (zh)
Inventor
瞿铭超
孙学军
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Hangzhou Anheng Information Security Technology Co Ltd
Original Assignee
Hangzhou Anheng Information Security Technology Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Hangzhou Anheng Information Security Technology Co Ltd filed Critical Hangzhou Anheng Information Security Technology Co Ltd
Priority to CN202010996716.7A priority Critical patent/CN112100536A/en
Publication of CN112100536A publication Critical patent/CN112100536A/en
Withdrawn legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/90Details of database functions independent of the retrieved data types
    • G06F16/95Retrieval from the web
    • G06F16/955Retrieval from the web using information identifiers, e.g. uniform resource locators [URL]
    • G06F16/9566URL specific, e.g. using aliases, detecting broken or misspelled links

Landscapes

  • Engineering & Computer Science (AREA)
  • Databases & Information Systems (AREA)
  • Theoretical Computer Science (AREA)
  • Data Mining & Analysis (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Information Transfer Between Computers (AREA)

Abstract

本申请公开了一种网页访问方法、装置、设备及计算机可读存储介质,该方法包括:若检测到对目标网页中的接口调用失败,则记录目标网页对应的目标url;向第一服务器发送登录请求;第一服务器对应的网页与目标网页具有不同的域名;获取第一服务器发送的令牌,并利用令牌和目标url向目标网页对应的第二服务器发送访问请求,以便重新对目标网页进行访问;该方法通过记录目标网页对应的目标url,以便利用令牌和目标url向第二服务器发送访问请求;由于在访问请求中加入了目标url,同时携带了新的令牌,因此可以对目标网页直接进行访问,无需用户进行操作,避免了繁琐的操作,网页访问时间较短,改善了用户体验。

Figure 202010996716

The present application discloses a web page access method, device, device and computer-readable storage medium. The method includes: if it is detected that an interface invocation in a target web page fails, recording a target url corresponding to the target web page; sending a message to a first server Login request; the web page corresponding to the first server and the target web page have different domain names; obtain the token sent by the first server, and use the token and the target url to send an access request to the second server corresponding to the target web page, so as to re-register the target web page access; this method records the target url corresponding to the target web page, so as to use the token and the target url to send an access request to the second server; since the target url is added to the access request and a new token is carried, it can The target web page can be accessed directly without the user's operation, which avoids cumbersome operations, shortens the web page access time, and improves the user experience.

Figure 202010996716

Description

一种网页访问方法、装置、设备及可读存储介质A web page access method, apparatus, device and readable storage medium

技术领域technical field

本申请涉及网络技术领域,特别涉及一种网页访问方法、网页访问装置、网页访问设备及计算机可读存储介质。The present application relates to the field of network technologies, and in particular, to a web page access method, a web page access device, a web page access device, and a computer-readable storage medium.

背景技术Background technique

在实际应用,存在以下情况:有2套网页系统(以下称为A系统和B系统),它们不在一个域名下,本地缓存和cookie无法公用,但是它们共用同一个用户中心,同一个权限和用户体系,且只在A系统中设置登录界面。用户需要令牌(即token)对网页进行访问,在令牌过期后需要重新登录以获取新的令牌。相关技术在重新登录后,可以跳转回在同一系统内的重新登录前所处的网页(即A系统内的任意网页),或者跳转到另一系统(即B系统)的首页。然而,若用户在重新登录前所处的网页为B系统中非首页的网页,则需要用户重新操作进入重新登录前所处的网页,导致操作繁琐,网页访问所需的时间较长,用户体验差。In practical applications, there are the following situations: there are two sets of web systems (hereinafter referred to as system A and system B), they are not under the same domain name, local cache and cookies cannot be shared, but they share the same user center, the same authority and user system, and only set the login interface in system A. The user needs a token (ie, token) to access the web page, and after the token expires, he needs to log in again to obtain a new token. In the related art, after re-login, it is possible to jump back to the web page in the same system before re-login (ie, any web page in system A), or jump to the home page of another system (ie, system B). However, if the web page the user is on before re-login is a non-home page in system B, the user needs to re-operate to enter the web page where he was before re-login, resulting in cumbersome operations, long time required for web page access, and poor user experience. Difference.

因此,相关技术存在的操作繁琐,用户体验差的问题,是本领域技术人员需要解决的技术问题。Therefore, the related art has the problems of complicated operation and poor user experience, which are technical problems to be solved by those skilled in the art.

发明内容SUMMARY OF THE INVENTION

有鉴于此,本申请的目的在于提供一种网页访问方法、网页访问装置、网页访问设备及计算机可读存储介质,可以对目标网页直接进行访问,避免了繁琐的操作。In view of this, the purpose of the present application is to provide a web page access method, a web page access device, a web page access device and a computer-readable storage medium, which can directly access a target web page and avoid cumbersome operations.

为解决上述技术问题,本申请提供了一种网页访问方法,包括:In order to solve the above-mentioned technical problems, the present application provides a web page access method, including:

若检测到对目标网页中的接口调用失败,则记录所述目标网页对应的目标url;If it is detected that the interface invocation in the target web page fails, record the target url corresponding to the target web page;

向第一服务器发送登录请求;所述第一服务器对应的网页与所述目标网页具有不同的域名;Send a login request to the first server; the webpage corresponding to the first server and the target webpage have different domain names;

获取所述第一服务器发送的令牌,并利用所述令牌和所述目标url向所述目标网页对应的第二服务器发送访问请求,以便重新对所述目标网页进行访问。The token sent by the first server is acquired, and an access request is sent to the second server corresponding to the target webpage by using the token and the target url, so as to re-access the target webpage.

可选地,所述利用所述令牌和所述目标url向所述目标网页对应的第二服务器发送访问请求,包括:Optionally, the sending an access request to the second server corresponding to the target webpage by using the token and the target url includes:

利用所述目标url生成初始访问请求;Use the target url to generate an initial access request;

在所述初始访问请求中添加令牌,得到所述访问请求,并将所述访问请求发送给所述第二服务器。A token is added to the initial access request, the access request is obtained, and the access request is sent to the second server.

可选地,所述向第一服务器发送登录请求,包括:Optionally, the sending a login request to the first server includes:

获取用户名信息和密码信息;Obtain user name information and password information;

利用所述用户名信息和所述密码信息生成所述登录请求;generating the login request using the username information and the password information;

将所述登录请求发送给所述第一服务器,以便所述第一服务器对所述用户名信息和所述密码信息进行校验,并在校验通过后利用所述令牌对所述登录请求进行响应。Send the login request to the first server, so that the first server verifies the user name information and the password information, and uses the token to verify the login request after the verification is passed. respond.

可选地,在所述获取所述第一服务器发送的令牌之后,还包括:Optionally, after obtaining the token sent by the first server, the method further includes:

清空本地缓存,并将所述令牌在所述本地缓存中存储。Flush the local cache and store the token in the local cache.

可选地,所述记录所述目标网页对应的目标url,包括:Optionally, the recording of the target url corresponding to the target web page includes:

利用referrer属性记录所述目标url。The target url is recorded using the referrer attribute.

可选地,在所述获取所述第一服务器发送的令牌之后,在所述利用所述令牌和所述目标url向所述目标网页对应的第二服务器发送访问请求之前,还包括:Optionally, after the obtaining the token sent by the first server, before the sending an access request to the second server corresponding to the target webpage by using the token and the target url, the method further includes:

判断是否存在跳转url;Determine whether there is a jump url;

若不存在所述跳转url,则向所述第一服务器或所述第二服务器发送默认访问请求;If the jump url does not exist, send a default access request to the first server or the second server;

若存在所述跳转url,则判断所述跳转url是否为所述目标url;If there is the jump url, then determine whether the jump url is the target url;

若所述跳转url不为所述目标url,则利用所述跳转url和所述令牌向所述第一服务器发送所述访问请求;If the jump url is not the target url, send the access request to the first server by using the jump url and the token;

若所述跳转url为所述目标url,则执行所述利用所述令牌和所述目标url向所述目标网页对应的第二服务器发送访问请求的步骤。If the jump url is the target url, the step of sending an access request to the second server corresponding to the target webpage by using the token and the target url is performed.

可选地,所述接口调用失败的检测过程,包括:Optionally, the detection process of the interface invocation failure includes:

向所述第二服务器发送所述目标网页上目标接口对应的接口调用请求;sending an interface invocation request corresponding to the target interface on the target webpage to the second server;

判断所述第二服务器的响应内容是否为错误码;Determine whether the response content of the second server is an error code;

若所述响应内容为所述错误码,则确定检测到对所述目标网页中的所述目标接口调用失败。If the response content is the error code, it is determined that a failure to call the target interface in the target webpage is detected.

本申请还提供了一种网页访问装置,包括:The application also provides a web page access device, including:

记录模块,用于若检测到对目标网页中的接口调用失败,则记录所述目标网页对应的目标url;a recording module, configured to record the target url corresponding to the target webpage if it is detected that the interface invocation in the target webpage fails;

登录模块,用于向第一服务器发送登录请求;所述第一服务器对应的网页与所述目标网页具有不同的域名;a login module, configured to send a login request to a first server; the webpage corresponding to the first server and the target webpage have different domain names;

访问模块,用于获取所述第一服务器发送的令牌,并利用所述令牌和所述目标url向所述目标网页对应的第二服务器发送访问请求,以便重新对所述目标网页进行访问。an access module, configured to obtain the token sent by the first server, and use the token and the target url to send an access request to the second server corresponding to the target web page, so as to re-access the target web page .

本申请还提供了一种网页访问设备,包括存储器和处理器,其中:The present application also provides a web page access device, including a memory and a processor, wherein:

所述存储器,用于保存计算机程序;the memory for storing computer programs;

所述处理器,用于执行所述计算机程序,以实现上述的网页访问方法。The processor is configured to execute the computer program to implement the above-mentioned web page access method.

本申请还提供了一种计算机可读存储介质,用于保存计算机程序,其中,所述计算机程序被处理器执行时实现上述的网页访问方法。The present application also provides a computer-readable storage medium for storing a computer program, wherein when the computer program is executed by a processor, the above-mentioned web page access method is implemented.

本申请提供的网页访问方法,若检测到对目标网页中的接口调用失败,则记录目标网页对应的目标url;向第一服务器发送登录请求;第一服务器对应的网页与目标网页具有不同的域名;获取第一服务器发送的令牌,并利用令牌和目标url向目标网页对应的第二服务器发送访问请求,以便重新对目标网页进行访问。In the web page access method provided by the present application, if it is detected that the interface call in the target web page fails, the target url corresponding to the target web page is recorded; a login request is sent to the first server; the web page corresponding to the first server and the target web page have different domain names ; Obtain the token sent by the first server, and use the token and the target url to send an access request to the second server corresponding to the target web page, so as to re-access the target web page.

可见,该方法在检测到对目标网页中的接口调用失败时,说明令牌失效,需要重新登陆。第一服务器对应的网页与目标网页具有不同的域名,说明目标网页属于不具有登录界面的网页的系统。记录目标网页对应的目标url,以便在后续直接对目标网页进行访问。在重新登陆时,向第一服务器发送登陆请求,在获取第一服务器发送的令牌后,利用令牌和目标url向第二服务器发送访问请求。访问请求携带了新的令牌,因此可以访问第二服务器上的网页,且在访问请求中加入了目标url,因此可以对目标网页直接进行访问,无需用户进行操作,避免了繁琐的操作,网页访问时间较短,改善了用户体验。It can be seen that when the method detects that the interface call in the target web page fails, it indicates that the token is invalid and needs to log in again. The web page corresponding to the first server and the target web page have different domain names, indicating that the target web page belongs to a system that does not have a web page with a login interface. The target url corresponding to the target webpage is recorded, so that the target webpage can be accessed directly in the future. When logging in again, a login request is sent to the first server, and after obtaining the token sent by the first server, an access request is sent to the second server by using the token and the target url. The access request carries a new token, so the web page on the second server can be accessed, and the target url is added to the access request, so the target web page can be accessed directly without the user's operation, which avoids cumbersome operations. Shorter access times improve user experience.

此外,本申请还提供了一种网页访问装置、网页访问设备及计算机可读存储介质,同样具有上述有益效果。In addition, the present application also provides a web page access device, a web page access device and a computer-readable storage medium, which also have the above beneficial effects.

附图说明Description of drawings

为了更清楚地说明本申请实施例或现有技术中的技术方案,下面将对实施例或现有技术描述中所需要使用的附图作简单地介绍,显而易见地,下面描述中的附图仅仅是本申请的实施例,对于本领域普通技术人员来讲,在不付出创造性劳动的前提下,还可以根据提供的附图获得其他的附图。In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, the following briefly introduces the accompanying drawings required for the description of the embodiments or the prior art. Obviously, the drawings in the following description are only It is an embodiment of the present application. For those of ordinary skill in the art, other drawings can also be obtained according to the provided drawings without any creative effort.

图1为本申请实施例提供的一种网页访问方法流程图;1 is a flowchart of a method for accessing a webpage provided by an embodiment of the present application;

图2为本申请实施例提供的一种数据流向示意图;2 is a schematic diagram of a data flow provided by an embodiment of the present application;

图3为本申请实施例提供的一种登录流程示意图;3 is a schematic diagram of a login process provided by an embodiment of the present application;

图4为本申请实施例提供的另一种网页访问方法流程图;FIG. 4 is a flowchart of another web page access method provided by an embodiment of the present application;

图5为本申请实施例提供的一种网页访问装置的结构示意图;FIG. 5 is a schematic structural diagram of a webpage access device provided by an embodiment of the present application;

图6为本申请实施例提供的一种网页访问设备的结构示意图。FIG. 6 is a schematic structural diagram of a device for accessing a webpage according to an embodiment of the present application.

具体实施方式Detailed ways

为使本申请实施例的目的、技术方案和优点更加清楚,下面将结合本申请实施例中的附图,对本申请实施例中的技术方案进行清楚、完整地描述,显然,所描述的实施例仅仅是本申请一部分实施例,而不是全部的实施例。基于本申请中的实施例,本领域普通技术人员在没有做出创造性劳动前提下所获得的所有其他实施例,都属于本申请保护的范围。In order to make the purposes, technical solutions and advantages of the embodiments of the present application clearer, the technical solutions in the embodiments of the present application will be described clearly and completely below with reference to the drawings in the embodiments of the present application. Obviously, the described embodiments It is only a part of the embodiments of the present application, but not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by those of ordinary skill in the art without creative efforts shall fall within the protection scope of the present application.

请参考图1,图1为本申请实施例提供的一种网页访问方法流程图。该方法包括:Please refer to FIG. 1 , which is a flowchart of a method for accessing a webpage according to an embodiment of the present application. The method includes:

S101:若检测到对目标网页中的接口调用失败,则记录目标网页对应的目标url。S101: If it is detected that the interface call in the target web page fails, record the target url corresponding to the target web page.

需要说明的是,可以利用网页访问设备执行本申请实施例中的部分或全部步骤。网页访问设备具体可以为电脑、智能手机等终端,本实施例对网页访问设备的具体形式不做限定。本实施例中目标网页为当前正在访问的网页,需要说明的是,其同样是不具有登录页面的网页系统对应的非首页网页。在本实施例中,利用A系统表示具有登录页面的网页系统,利用B系统表示不具有登录页面的网页系统。可以理解的是,目标网页即为B系统中的任一个非首页的网页。由于在访问任意网页时均需要对应的令牌(即token),而令牌具有时限寿命。在目标网页访问过久,即在目标网页停留太久时,会导致令牌过期,在令牌过期后对目标网页中的接口进行调用时,则无法成功调用,会检测到对目标网页中的接口调用失败。本实施例并不限定接口的具体内容和形式,例如可以为下载接口,形式可以为文字或图像。本实施例并不限定检测接口调用失败的具体方式,例如可以判断服务器是否响应,或者可以判断服务器是否做出了正确的响应。It should be noted that, some or all of the steps in the embodiments of the present application may be performed by using a web page access device. The webpage access device may specifically be a terminal such as a computer and a smart phone, and the specific form of the webpage access device is not limited in this embodiment. In this embodiment, the target web page is the web page currently being accessed. It should be noted that it is also a non-home page corresponding to a web page system that does not have a login page. In this embodiment, the A system is used to represent a web page system with a login page, and the B system is used to represent a web page system without a login page. It can be understood that the target webpage is any webpage in the B system that is not the homepage. Since a corresponding token (ie, token) is required when accessing any webpage, the token has a time-limited lifespan. If the target web page is accessed for too long, that is, if the target web page stays for too long, the token will expire. Interface call failed. This embodiment does not limit the specific content and form of the interface, for example, it can be a download interface, and the form can be text or image. This embodiment does not limit the specific manner of detecting the failure of the interface invocation. For example, it can be determined whether the server responds, or it can be determined whether the server has made a correct response.

若检测到了接口调用失败,则说明令牌已经无效,需要重新登录以获取新的令牌。为了在登录获取到新令牌后对网页直接进行访问,本实施例中还需要记录目标网页对应的目标url。URL即为统一资源定位符(Uniform Resource Locator),又叫做网页地址,是互联网上标准的资源的地址(Address)。通过记录目标url,可以在登录后利用目标url直接对目标网页进行访问。本实施例并不限定记录目标url的具体方式,例如可以利用新增的专门的变量记录目标url,或者可以利用已有的变量记录目标url。If it is detected that the interface call fails, the token is invalid, and you need to log in again to obtain a new token. In order to directly access the webpage after logging in and obtaining the new token, in this embodiment, the target url corresponding to the target webpage needs to be recorded. URL is the Uniform Resource Locator (Uniform Resource Locator), also known as the web page address, which is the standard resource address (Address) on the Internet. By recording the target url, you can use the target url to directly access the target web page after logging in. This embodiment does not limit the specific manner of recording the target url, for example, a new special variable can be used to record the target url, or an existing variable can be used to record the target url.

在一种可能的实施方式中,为了准确检测是否发生了接口调用失败,接口调用失败的检测过程可以包括:In a possible implementation manner, in order to accurately detect whether an interface invocation failure occurs, the detection process of the interface invocation failure may include:

步骤11:向第二服务器发送目标网页上目标接口对应的接口调用请求。Step 11: Send an interface invocation request corresponding to the target interface on the target webpage to the second server.

步骤12:判断第二服务器的响应内容是否为错误码。Step 12: Determine whether the response content of the second server is an error code.

步骤13:若响应内容为错误码,则确定检测到对目标网页中的目标接口调用失败。Step 13: If the response content is an error code, it is determined that it is detected that the invocation of the target interface in the target web page fails.

目标接口可以为目标网页上的任意一个接口,接口调用请求与目标接口相对应,其具体内容和形式不做限定。通过向第二服务器发送对目标接口进行调用的接口调用请求,可以使第二服务器对接口调用请求进行响应,即得到第二服务器发送的响应内容。通过判断响应内容是否为错误码,可以判断是否调用成功,若所述响应内容为错误码,例如为401状态码,则说明对目标接口的调用失败,因此可以确定检测到接口调用失败。利用该接口调用失败检测方式,可以避免因第二服务器响应超时而被错误地认定为接口调用失败,提高了接口调用失败的检测准确率。The target interface can be any interface on the target web page, and the interface call request corresponds to the target interface, and its specific content and form are not limited. By sending an interface invocation request for invoking the target interface to the second server, the second server can be made to respond to the interface invocation request, that is, the response content sent by the second server can be obtained. By judging whether the response content is an error code, it can be determined whether the invocation is successful. If the response content is an error code, such as a 401 status code, it means that the invocation of the target interface fails, so it can be determined that the interface invocation failure is detected. By using the interface invocation failure detection method, it is possible to avoid being mistakenly identified as the interface invocation failure due to the timeout of the response of the second server, thereby improving the detection accuracy of the interface invocation failure.

在一种实施方式中,可以利用referrer属性记录目标url。referrer属性即为document.reffer字段,其可以记录返回载入当前文件的url。因此利用document.reffer字段可以对目标url进行记录,不需要新增专门的字段对目标url进行记录。In one embodiment, the target url can be recorded using the referrer attribute. The referrer attribute is the document.reffer field, which can record and return the url that loads the current file. Therefore, the document.reffer field can be used to record the target url, and there is no need to add a special field to record the target url.

S102:向第一服务器发送登录请求。S102: Send a login request to the first server.

需要说明的是,第一服务器对应的网页与目标网页具有不同的域名。由于A系统和B系统对应于不同的域名,因此当目标网页为B系统中的非首页网页时,第一服务器即为A系统对应的服务器。只有A系统才包括用于登陆的登录页面,因此在令牌失效后,需要向第一服务器发送登陆请求,以便重新进行登录。登陆请求的具体内容和形式不做限定,其可以包括用户名和密码等登录所需的必要信息,或者还可以包括验证码等信息。信息可以由用户输入,或者可以从预存位置将预存的信息进行读取,进而生成登录请求。It should be noted that the webpage corresponding to the first server and the target webpage have different domain names. Since system A and system B correspond to different domain names, when the target webpage is a non-homepage webpage in system B, the first server is the server corresponding to system A. Only system A includes a login page for login, so after the token expires, a login request needs to be sent to the first server in order to log in again. The specific content and form of the login request are not limited, and it may include necessary information required for login such as user name and password, or may also include information such as verification code. The information may be input by the user, or the pre-stored information may be read from the pre-stored location, thereby generating a login request.

具体的,S102步骤可以包括:Specifically, step S102 may include:

步骤21:获取用户名信息和密码信息。Step 21: Obtain user name information and password information.

步骤22:利用用户名信息和密码信息生成登录请求。Step 22: Generate a login request using the user name information and the password information.

步骤23:将登录请求发送给第一服务器,以便第一服务器对用户名信息和密码信息进行校验,并在校验通过后利用令牌对登录请求进行响应。Step 23: Send the login request to the first server, so that the first server verifies the user name information and the password information, and uses the token to respond to the login request after the verification is passed.

在本实施例中,为了减少登录请求的长度,可以仅获取用户名信息和密码信息,并利用其生成登录请求。在得到登录请求后,将其发送给第一服务器。第一服务器在获取登录请求后对其解析,并对解析得到的用户名信息和密码信息进行校验,具体的校验过程不做限定,例如可以利用用户名信息在数据库中进行查找,得到对应的密码,并将该密码与密码信息进行匹配,判断二者是否相同。若二者相同,则可以确定通过校验,若不同,则确定没有校验。在校验通过后,第一服务器可以利用新的令牌对登录请求进行响应,即发送令牌给网页访问设备。In this embodiment, in order to reduce the length of the login request, only user name information and password information may be acquired, and a login request may be generated by using them. After getting the login request, send it to the first server. The first server parses the login request after obtaining it, and verifies the user name information and password information obtained by the analysis. The specific verification process is not limited. For example, the user name information can be used to search in the database to obtain the corresponding password, and match the password with the password information to determine whether the two are the same. If the two are the same, it can be determined that the verification is passed, and if they are different, it is determined that there is no verification. After the verification is passed, the first server can use the new token to respond to the login request, that is, send the token to the webpage access device.

S103:获取第一服务器发送的令牌,并利用令牌和目标url向目标网页对应的第二服务器发送访问请求,以便重新对目标网页进行访问。S103: Obtain the token sent by the first server, and send an access request to the second server corresponding to the target webpage by using the token and the target url, so as to re-access the target webpage.

在获取到第一服务器发送的令牌后,可以利用该令牌与目标url共同生成访问请求,并将该访问请求发送给第二服务器,本实施例并不限定访问请求的具体生成方式。第二服务器与目标网页相对应,在访问请求中包括目标url并包括了合法的令牌后,第二服务器可以允许网页访问设备直接对目标网页进行访问。具体的,第二服务器可以对令牌进行提取,并对该令牌进行检测。在确定该令牌合法后,可以允许访问目标网页。提取令牌的具体方式不做限定,在一种实施方式中,可以为第二服务器中的各个网页写入提取令牌所需的逻辑代码;若网页过多,则为每个网页写入对应的逻辑代码过于繁琐,因此在另一种实施方式中,可以利用导航守卫对令牌进行提取。导航守卫的具体形式不做限定,例如可对于vue框架(一种前端框架)来说,其导航守卫即为vue-router,具体可以在router.beforeEach中,通过to.query属性判断请求中是否存在令牌,并在存在令牌时获取该令牌并进行存储。需要说明的是,在一种实施方式中,第一服务器和第二服务器为不同的服务器;在另一种实施方式中,第一服务器和第二服务器可以为相同的服务器,其在运行A系统、执行A系统对应的业务时为第一服务器,在运行B系统,执行B系统对应的业务时为第二服务器。After obtaining the token sent by the first server, the token and the target url can be used to generate an access request, and the access request is sent to the second server. This embodiment does not limit the specific generation method of the access request. The second server corresponds to the target web page, and after the access request includes the target url and a valid token, the second server may allow the web page access device to directly access the target web page. Specifically, the second server may extract the token and detect the token. After determining that the token is valid, access to the target web page can be allowed. The specific method of extracting the token is not limited. In one embodiment, the logic code required for extracting the token can be written for each webpage in the second server; if there are too many webpages, the corresponding code is written for each webpage. The logic code is too cumbersome, so in another implementation, the token can be extracted using the navigation guard. The specific form of the navigation guard is not limited. For example, for the vue framework (a front-end framework), the navigation guard is vue-router. Specifically, in router.beforeEach, the to.query attribute can be used to determine whether the request exists. token, and get the token when it exists and store it. It should be noted that, in one embodiment, the first server and the second server are different servers; in another embodiment, the first server and the second server may be the same server, which is running system A . The first server is the first server when executing the service corresponding to the A system, and the second server is the second server when the B system is running and the service corresponding to the B system is executed.

在一种实施方式中,利用令牌和目标url向目标网页对应的第二服务器发送访问请求的步骤可以包括:In one embodiment, the step of using the token and the target url to send an access request to the second server corresponding to the target webpage may include:

步骤31:利用目标url生成初始访问请求。Step 31: Use the target url to generate an initial access request.

步骤32:在初始访问请求中添加令牌,得到访问请求,并将访问请求发送给第二服务器。Step 32: Add a token to the initial access request, obtain the access request, and send the access request to the second server.

本实施例中,在生成访问请求时,先利用目标url生成初始访问请求,生成初始访问请求的具体方式不做限定。在得到初始访问请求后,可以在初始访问请求中添加令牌,具体的,可以利用axios.defaults.headers.Authorization函数将令牌放入初始访问请求的请求头中,得到访问请求,并将该访问请求发送给第二服务器。In this embodiment, when generating the access request, the target url is used to generate the initial access request first, and the specific manner of generating the initial access request is not limited. After the initial access request is obtained, a token can be added to the initial access request. Specifically, the axios.defaults.headers.Authorization function can be used to put the token into the request header of the initial access request to obtain the access request, and use the axios.defaults.headers.Authorization function. The access request is sent to the second server.

在一种具体的实施方式中,在获取第一服务器发送的令牌后,可以在本地进行存储。具体的,在获取第一服务器发送的令牌之后,还可以包括:In a specific implementation manner, after acquiring the token sent by the first server, it can be stored locally. Specifically, after acquiring the token sent by the first server, it may further include:

步骤41:清空本地缓存,并将令牌在本地缓存中存储。Step 41: Clear the local cache and store the token in the local cache.

本实施例中,在对令牌进行存储之前,可以清空本地缓存(即localstorage),避免其中已存储的旧令牌或者其他业务缓存影响存储流程,进而导致bug(漏洞),进而造成新令牌存入错误。因此可以在清空本地缓存后将令牌存入本地缓存。In this embodiment, before the token is stored, the local cache (ie, localstorage) can be cleared, so as to prevent the stored old token or other service cache from affecting the storage process, thereby causing bugs (vulnerabilities), and then causing new tokens Error saving. So the token can be stored in the local cache after clearing the local cache.

基于上述实施例,本实施例并不限定上述各个步骤的执行顺序。因此可能直接执行S103步骤,即获取到了第一服务器发送的令牌,此时可能出现以下情况:在实际应用中,获取到令牌后进行网页访问时可能并不需要跳转到B系统的网页。用户可能在A系统中的某个网页停留时间过长造成令牌失效,或者第一次登陆A系统。在这种情况下,同样会接收到第一服务器发送的令牌。此时利用目标url进行网页访问可能会访问到错误的网页,即并不是用户想要访问的网页。针对上述问题,在获取第一服务器发送的令牌之后,在利用令牌和目标url向目标网页对应的第二服务器发送访问请求之前,还可以包括:Based on the foregoing embodiments, this embodiment does not limit the execution order of the foregoing steps. Therefore, step S103 may be directly executed, that is, the token sent by the first server may be obtained. At this time, the following situation may occur: In practical applications, it may not be necessary to jump to the webpage of system B when accessing the webpage after obtaining the token. . The user may stay on a webpage in system A for too long, causing the token to fail, or log in to system A for the first time. In this case, the token sent by the first server is also received. At this time, using the target url to access the webpage may access the wrong webpage, that is, the webpage that the user wants to visit. In view of the above problem, after obtaining the token sent by the first server, before using the token and the target url to send an access request to the second server corresponding to the target web page, the method may further include:

步骤51:判断是否存在跳转url。Step 51: Determine whether there is a redirect url.

步骤52:若不存在跳转url,则向第一服务器或第二服务器发送默认访问请求。Step 52: If there is no redirect url, send a default access request to the first server or the second server.

步骤53:若存在跳转url,则判断跳转url是否为目标url。Step 53: If there is a jumping url, it is judged whether the jumping url is the target url.

步骤54:若跳转url不为目标url,则利用跳转url和令牌向第一服务器发送访问请求。Step 54: If the jump url is not the target url, send an access request to the first server by using the jump url and the token.

步骤55:若跳转url为目标url,则执行利用令牌和目标url向目标网页对应的第二服务器发送访问请求的步骤。Step 55: If the jump url is the target url, the step of sending an access request to the second server corresponding to the target webpage by using the token and the target url is performed.

本实施例中,跳转url即为获取令牌前用户访问的网页的url,其可以为A系统中任一网页对应的url,或者可以为B系统中任一网页对应的url。若存在跳转url,则说明在令牌失效时正在访问该跳转url对应的网页,因此在进行登录时需要访问跳转url对应的网页。若不存在跳转url,则说明时第一次访问,因此可以向第一服务器或第二服务器发送默认访问请求,默认访问请求用于登录网页系统的首页。向第一服务器发送默认访问请求,则访问A系统的首页,向第二服务器发送默认访问请求,则访问B系统的首页,具体向那个服务器发送默认访问请求可以根据实际情况进行设置,本实施例对此不做限定。In this embodiment, the jump url is the url of the webpage accessed by the user before obtaining the token, which may be the url corresponding to any webpage in the A system, or the url corresponding to any webpage in the B system. If there is a jump url, it means that the webpage corresponding to the jump url is being accessed when the token is invalid, so you need to access the webpage corresponding to the jump url when logging in. If there is no jump url, it indicates the first visit, so a default visit request can be sent to the first server or the second server, and the default visit request is used to log in to the home page of the web page system. Send a default access request to the first server to access the home page of system A, and send a default access request to the second server to access the home page of system B. The specific server to send a default access request can be set according to the actual situation. This embodiment This is not limited.

若存在跳转url,则判断跳转url是否为目标url,即判断先前访问的网页是否属于A系统。若跳转url为目标url,则说明先前访问的网页属于B系统,因此执行利用令牌和目标url向目标网页对应的第二服务器发送访问请求的步骤,即S103中的步骤。若跳转url不为目标url,则说明先前访问的网页属于A系统,因此可以利用令牌和跳转url向第一服务器发送访问请求,以便在登录后直接访问跳转url对应的网页。本实施例并不限定判断跳转url是否为目标url的具体判断方式,例如可以截取跳转url的host部分,判断其是否为A系统对应的域名,若是,则跳转url不为目标url。If there is a jump url, it is judged whether the jump url is the target url, that is, it is judged whether the previously visited webpage belongs to the A system. If the jump url is the target url, it means that the previously accessed web page belongs to the B system, so the step of using the token and the target url to send an access request to the second server corresponding to the target web page, that is, the step in S103 is performed. If the jump url is not the target url, it means that the previously accessed web page belongs to the A system, so the token and the jump url can be used to send an access request to the first server, so as to directly access the webpage corresponding to the jump url after logging in. This embodiment does not limit the specific method of judging whether the redirected url is the target url. For example, the host part of the redirected url can be intercepted to determine whether it is the domain name corresponding to the A system. If so, the redirected url is not the target url.

应用本申请实施例提供的网页访问方法,在检测到对目标网页中的接口调用失败时,说明令牌失效,需要重新登陆。第一服务器对应的网页与目标网页具有不同的域名,说明目标网页属于不具有登录界面的网页的系统。记录目标网页对应的目标url,以便在后续直接对目标网页进行访问。在重新登陆时,向第一服务器发送登陆请求,在获取第一服务器发送的令牌后,利用令牌和目标url向第二服务器发送访问请求。访问请求携带了新的令牌,因此可以访问第二服务器上的网页,且在访问请求中加入了目标url,因此可以对目标网页直接进行访问,无需用户进行操作,避免了繁琐的操作,网页访问时间较短,改善了用户体验。By applying the web page access method provided by the embodiment of the present application, when it is detected that the interface call in the target web page fails, it indicates that the token is invalid and needs to log in again. The web page corresponding to the first server and the target web page have different domain names, indicating that the target web page belongs to a system that does not have a web page with a login interface. The target url corresponding to the target webpage is recorded, so that the target webpage can be accessed directly in the future. When logging in again, a login request is sent to the first server, and after obtaining the token sent by the first server, an access request is sent to the second server by using the token and the target url. The access request carries a new token, so the web page on the second server can be accessed, and the target url is added to the access request, so the target web page can be accessed directly without the user's operation, which avoids cumbersome operations. Shorter access times improve user experience.

基于上述实施例,本实施例说明一种具体的网页访问过程。请参考图2,图2为本申请实施例提供的一种数据流向示意图。本实施例中,利用客户端作为网页访问设备,客户端具体可以为智能手机、电脑等终端。客户端发送接口调用请求给第二服务器,第二服务器发现令牌过期后反馈错误码,客户端在接收到错误码后向第一服务器发送登录请求。具体的,请参考图3,图3为本申请实施例提供的一种登录流程示意图。在获取username(用户名信息)和password(密码信息)在前端(即客户端)加密后发送给第一服务器,在后端(即第一服务器)进行解密并校验。若校验失败,则登陆失败,若校验成功,则向客户端返回token(即令牌)。前端(即客户端)获取token后进行缓存,并可以在后续调用token发送接口调用请求,若token有效则可以得到服务器反馈的数据,若token无效或错误则会得到错误码401。Based on the above embodiments, this embodiment describes a specific webpage access process. Please refer to FIG. 2 , which is a schematic diagram of a data flow according to an embodiment of the present application. In this embodiment, a client is used as a device for accessing a webpage, and the client may specifically be a terminal such as a smart phone or a computer. The client sends an interface invocation request to the second server, the second server returns an error code after finding that the token has expired, and the client sends a login request to the first server after receiving the error code. Specifically, please refer to FIG. 3 , which is a schematic diagram of a login process provided by an embodiment of the present application. The obtained username (user name information) and password (password information) are encrypted at the front end (ie the client) and sent to the first server, and decrypted and verified at the back end (ie the first server). If the verification fails, the login fails, and if the verification succeeds, a token (ie, token) is returned to the client. The front-end (ie, the client) obtains the token and caches it, and can subsequently call the token to send an interface call request. If the token is valid, the data fed back by the server can be obtained. If the token is invalid or incorrect, the error code 401 will be obtained.

将后端(即第一服务器)返回的token保存在localStorage(即本地缓存)中,并通过axios.defaults.headers.Authorization将加密后的token放入请求头中,随接口发送。每当token失效或是被恶意修改,接口返回401,通过拦截器获取到这一信息。页面将跳转回登录页,并且清空缓存中的token,等到用户下次成功登陆后,再记录新的token。Save the token returned by the backend (ie, the first server) in localStorage (ie, the local cache), and put the encrypted token into the request header through axios.defaults.headers.Authorization and send it with the interface. Whenever the token is invalid or maliciously modified, the interface returns 401, and this information is obtained through the interceptor. The page will jump back to the login page, and the token in the cache will be cleared, and the new token will be recorded after the user successfully logs in next time.

请参考图4,图4为本申请实施例提供的另一种网页访问方法流程图。在获取401错误码时,可以记住当前url,并利用oldurl字符串进行记录。在跳转登录页面时将将oldurl添加至url参数中,以便在登录成功后利用oldurl对目标页面直接进行访问。具体的,以vue框架为例,在B系统中,假设用户在X页面停留过久,token过期,调用接口失败后返回A系统的登陆页面,登陆成功后,由document.reffer属性确认需要跳转回B系统的X页面,因此获取到token字段,并将其存入localstorage中,接着在axios中带上token以便向第二服务器发起请求。Please refer to FIG. 4 , which is a flowchart of another method for accessing a webpage according to an embodiment of the present application. When getting the 401 error code, you can remember the current url and use the oldurl string to record. When jumping to the login page, the oldurl will be added to the url parameter, so that the oldurl can be used to directly access the target page after the login is successful. Specifically, taking the vue framework as an example, in system B, if the user stays on page X for too long, the token expires, and the interface fails to return to the login page of system A. After the login is successful, the document.reffer attribute confirms the need to jump Back to the X page of the B system, so the token field is obtained, and it is stored in the localstorage, and then the token is brought in the axios to initiate a request to the second server.

下面对本申请实施例提供的网页访问装置进行介绍,下文描述的网页访问装置与上文描述的网页访问方法可相互对应参照。The web page access apparatus provided by the embodiments of the present application is introduced below, and the web page access apparatus described below and the web page access method described above may refer to each other correspondingly.

请参考图5,图5为本申请实施例提供的一种网页访问装置的结构示意图,包括:Please refer to FIG. 5. FIG. 5 is a schematic structural diagram of a webpage access device provided by an embodiment of the present application, including:

记录模块110,用于若检测到对目标网页中的接口调用失败,则记录目标网页对应的目标url;The recording module 110 is configured to record the target url corresponding to the target webpage if it is detected that the interface call in the target webpage fails;

登录模块120,用于向第一服务器发送登录请求;第一服务器对应的网页与目标网页具有不同的域名;The login module 120 is configured to send a login request to the first server; the webpage corresponding to the first server and the target webpage have different domain names;

访问模块130,用于获取第一服务器发送的令牌,并利用令牌和目标url向目标网页对应的第二服务器发送访问请求,以便重新对目标网页进行访问。The access module 130 is configured to acquire the token sent by the first server, and use the token and the target url to send an access request to the second server corresponding to the target web page, so as to re-access the target web page.

可选地,访问模块130,包括:Optionally, access module 130 includes:

初始访问请求生成单元,用于利用目标url生成初始访问请求;The initial access request generating unit is used to generate the initial access request by using the target url;

访问请求发送单元,用于在初始访问请求中添加令牌,得到访问请求,并将访问请求发送给第二服务器。The access request sending unit is configured to add a token to the initial access request, obtain the access request, and send the access request to the second server.

可选地,登录模块120,包括:Optionally, the login module 120 includes:

信息获取单元,用于获取用户名信息和密码信息;an information acquisition unit, used to acquire user name information and password information;

登录请求生成单元,用于利用用户名信息和密码信息生成登录请求;a login request generating unit, used for generating a login request by using the user name information and the password information;

登录请求发送单元,用于将登录请求发送给第一服务器,以便第一服务器对用户名信息和密码信息进行校验,并在校验通过后利用令牌对登录请求进行响应。The login request sending unit is configured to send the login request to the first server, so that the first server verifies the user name information and the password information, and uses the token to respond to the login request after the verification is passed.

可选地,还包括:Optionally, also include:

清空本地缓存,并将令牌在本地缓存中存储。Flush the local cache and store the token in the local cache.

可选地,记录模块110,包括:Optionally, the recording module 110 includes:

属性记录单元,用于利用referrer属性记录目标url。The attribute record unit is used to record the target url using the referrer attribute.

可选地,还包括:Optionally, also include:

第一判断模块,用于判断是否存在跳转url;The first judgment module is used to judge whether there is a jump url;

第一发送模块,用于若不存在跳转url,则向第一服务器或第二服务器发送默认访问请求;a first sending module, configured to send a default access request to the first server or the second server if there is no jump url;

第二判断单元,用于若存在跳转url,则判断跳转url是否为目标url;The second judgment unit is used to judge whether the jump url is the target url if there is a jump url;

第二发送模块,用于若跳转url不为目标url,则利用跳转url和令牌向第一服务器发送访问请求;The second sending module is used to send an access request to the first server by using the jump url and the token if the jump url is not the target url;

相应的,访问模块130为若跳转url为目标url,则利用令牌和目标url向目标网页对应的第二服务器发送访问请求的模块。Correspondingly, the access module 130 is a module that uses the token and the target url to send an access request to the second server corresponding to the target webpage if the jump url is the target url.

可选地,记录模块110,包括:Optionally, the recording module 110 includes:

请求发送单元,用于向第二服务器发送目标网页上目标接口对应的接口调用请求;a request sending unit, configured to send an interface invocation request corresponding to the target interface on the target webpage to the second server;

内容判断单元,用于判断第二服务器的响应内容是否为错误码;a content judging unit for judging whether the response content of the second server is an error code;

确定单元,用于若响应内容为错误码,则确定检测到对目标网页中的目标接口调用失败。The determining unit is configured to determine that if the response content is an error code, it is detected that the invocation of the target interface in the target web page fails.

下面对本申请实施例提供的网页访问设备进行介绍,下文描述的网页访问设备与上文描述的网页访问方法可相互对应参照。The web page access device provided by the embodiments of the present application will be introduced below, and the web page access device described below and the web page access method described above may refer to each other correspondingly.

请参考图6,图6为本申请实施例提供的一种网页访问设备的结构示意图。其中网页访问设备100可以包括处理器101和存储器102,还可以进一步包括多媒体组件103、信息输入/信息输出(I/O)接口104以及通信组件105中的一种或多种。Please refer to FIG. 6 , which is a schematic structural diagram of a device for accessing a webpage according to an embodiment of the present application. The webpage access device 100 may include a processor 101 and a memory 102 , and may further include one or more of a multimedia component 103 , an information input/information output (I/O) interface 104 and a communication component 105 .

其中,处理器101用于控制网页访问设备100的整体操作,以完成上述的网页访问方法中的全部或部分步骤;存储器102用于存储各种类型的数据以支持在网页访问设备100的操作,这些数据例如可以包括用于在该网页访问设备100上操作的任何应用程序或方法的指令,以及应用程序相关的数据。该存储器102可以由任何类型的易失性或非易失性存储设备或者它们的组合实现,例如静态随机存取存储器(Static Random Access Memory,SRAM)、电可擦除可编程只读存储器(Electrically Erasable Programmable Read-OnlyMemory,EEPROM)、可擦除可编程只读存储器(Erasable Programmable Read-Only Memory,EPROM)、可编程只读存储器(Programmable Read-Only Memory,PROM)、只读存储器(Read-Only Memory,ROM)、磁存储器、快闪存储器、磁盘或光盘中的一种或多种。Wherein, the processor 101 is used to control the overall operation of the web page access device 100 to complete all or part of the steps in the above-mentioned web page access method; the memory 102 is used to store various types of data to support operations on the web page access device 100, These data may include, for example, instructions for any application or method to operate on the web page access device 100, as well as application-related data. The memory 102 may be implemented by any type of volatile or non-volatile memory device or a combination thereof, such as Static Random Access Memory (SRAM), Electrically Erasable Programmable Read-Only Memory (Electrically Erasable Programmable Read Only Memory) Erasable Programmable Read-Only Memory (EEPROM), Erasable Programmable Read-Only Memory (EPROM), Programmable Read-Only Memory (PROM), Read-Only Memory (Read-Only) One or more of Memory, ROM), magnetic memory, flash memory, magnetic disk or optical disk.

多媒体组件103可以包括屏幕和音频组件。其中屏幕例如可以是触摸屏,音频组件用于输出和/或输入音频信号。例如,音频组件可以包括一个麦克风,麦克风用于接收外部音频信号。所接收的音频信号可以被进一步存储在存储器102或通过通信组件105发送。音频组件还包括至少一个扬声器,用于输出音频信号。I/O接口104为处理器101和其他接口模块之间提供接口,上述其他接口模块可以是键盘,鼠标,按钮等。这些按钮可以是虚拟按钮或者实体按钮。通信组件105用于网页访问设备100与其他设备之间进行有线或无线通信。无线通信,例如Wi-Fi,蓝牙,近场通信(Near Field Communication,简称NFC),2G、3G或4G,或它们中的一种或几种的组合,因此相应的该通信组件105可以包括:Wi-Fi部件,蓝牙部件,NFC部件。Multimedia components 103 may include screen and audio components. Wherein the screen can be, for example, a touch screen, and the audio component is used for outputting and/or inputting audio signals. For example, the audio component may include a microphone for receiving external audio signals. The received audio signal may be further stored in the memory 102 or transmitted through the communication component 105 . The audio assembly also includes at least one speaker for outputting audio signals. The I/O interface 104 provides an interface between the processor 101 and other interface modules, and the above-mentioned other interface modules may be a keyboard, a mouse, a button, and the like. These buttons can be virtual buttons or physical buttons. The communication component 105 is used for wired or wireless communication between the web page access device 100 and other devices. Wireless communication, such as Wi-Fi, Bluetooth, Near Field Communication (NFC for short), 2G, 3G or 4G, or one or a combination of them, so the corresponding communication component 105 may include: Wi-Fi parts, Bluetooth parts, NFC parts.

网页访问设备100可以被一个或多个应用专用集成电路(Application SpecificIntegrated Circuit,简称ASIC)、数字信号处理器(Digital Signal Processor,简称DSP)、数字信号处理设备(Digital Signal Processing Device,简称DSPD)、可编程逻辑器件(Programmable Logic Device,简称PLD)、现场可编程门阵列(Field ProgrammableGate Array,简称FPGA)、控制器、微控制器、微处理器或其他电子元件实现,用于执行上述实施例给出的网页访问方法。The webpage accessing device 100 may be implemented by one or more Application Specific Integrated Circuit (ASIC for short), Digital Signal Processor (DSP for short), Digital Signal Processing Device (DSPD for short), Programmable Logic Device (Programmable Logic Device, PLD for short), Field Programmable Gate Array (Field Programmable Gate Array, FPGA for short), controller, microcontroller, microprocessor or other electronic components are implemented for implementing the above-mentioned embodiments. out page access method.

下面对本申请实施例提供的计算机可读存储介质进行介绍,下文描述的计算机可读存储介质与上文描述的网页访问方法可相互对应参照。The computer-readable storage medium provided by the embodiments of the present application is introduced below. The computer-readable storage medium described below and the web page access method described above may refer to each other correspondingly.

本申请还提供一种计算机可读存储介质,计算机可读存储介质上存储有计算机程序,计算机程序被处理器执行时实现上述的网页访问方法的步骤。The present application further provides a computer-readable storage medium, where a computer program is stored on the computer-readable storage medium, and when the computer program is executed by a processor, the steps of the above web page access method are implemented.

该计算机可读存储介质可以包括:U盘、移动硬盘、只读存储器(Read-OnlyMemory,ROM)、随机存取存储器(Random Access Memory,RAM)、磁碟或者光盘等各种可以存储程序代码的介质。The computer-readable storage medium may include: a USB flash drive, a removable hard disk, a read-only memory (Read-Only Memory, ROM), a random access memory (Random Access Memory, RAM), a magnetic disk or an optical disk, etc., which can store program codes. medium.

本说明书中各个实施例采用递进的方式描述,每个实施例重点说明的都是与其它实施例的不同之处,各个实施例之间相同或相似部分互相参见即可。对于实施例公开的装置而言,由于其与实施例公开的方法相对应,所以描述的比较简单,相关之处参见方法部分说明即可。The various embodiments in this specification are described in a progressive manner, and each embodiment focuses on the differences from other embodiments, and the same or similar parts of the various embodiments may be referred to each other. As for the device disclosed in the embodiment, since it corresponds to the method disclosed in the embodiment, the description is relatively simple, and the relevant part can be referred to the description of the method.

本领域技术人员还可以进一步意识到,结合本文中所公开的实施例描述的各示例的单元及算法步骤,能够以电子硬件、计算机软件或者二者的结合来实现,为了清楚地说明硬件和软件的可互换性,在上述说明中已经按照功能一般性地描述了各示例的组成及步骤。这些功能究竟以硬件还是软件的方式来执行,取决于技术方案的特定应用和设计约束条件。本领域技术人员可以对每个特定的应用来使用不同方法来实现所描述的功能,但是这种实现不应该认为超出本申请的范围。Those skilled in the art may further realize that the units and algorithm steps of each example described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, computer software, or a combination of the two, in order to clearly illustrate the hardware and software In the above description, the components and steps of each example have been generally described according to their functions. Whether these functions are performed in hardware or software depends on the specific application and design constraints of the technical solution. Skilled artisans may use different methods for implementing the described functionality for each particular application, but such implementations should not be considered beyond the scope of this application.

结合本文中所公开的实施例描述的方法或算法的步骤可以直接用硬件、处理器执行的软件模块,或者二者的结合来实施。软件模块可以置于随机存储器(RAM)、内存、只读存储器(ROM)、电可编程ROM、电可擦除可编程ROM、寄存器、硬盘、可移动磁盘、CD-ROM、或技术领域内所公知的任意其它形式的存储介质中。The steps of a method or algorithm described in conjunction with the embodiments disclosed herein may be directly implemented in hardware, a software module executed by a processor, or a combination of the two. A software module can be placed in random access memory (RAM), internal memory, read only memory (ROM), electrically programmable ROM, electrically erasable programmable ROM, registers, hard disk, removable disk, CD-ROM, or any other in the technical field. in any other known form of storage medium.

最后,还需要说明的是,在本文中,诸如第一和第二等之类的关系属于仅仅用来将一个实体或者操作与另一个实体或者操作区分开来,而不一定要求或者暗示这些实体或操作之间存在任何这种实际的关系或者顺序。而且,术语包括、包含或者其他任何变体意在涵盖非排他性的包含,从而使得包括一系列要素的过程、方法、物品或者设备不仅包括那些要素,而且还包括没有明确列出的其他要素,或者是还包括为这种过程、方法、物品或者设备所固有的要素。Finally, it should also be noted that, in this context, relationships such as first and second, etc., are used only to distinguish one entity or operation from another, and do not necessarily require or imply these entities or that there is any such actual relationship or sequence between operations. Furthermore, the terms including, comprising or any other variation are intended to cover non-exclusive inclusion such that a process, method, article or device comprising a series of elements includes not only those elements but also other elements not expressly listed, or Yes also includes elements inherent to such a process, method, article or apparatus.

本文中应用了具体个例对本申请的原理及实施方式进行了阐述,以上实施例的说明只是用于帮助理解本申请的方法及其核心思想;同时,对于本领域的一般技术人员,依据本申请的思想,在具体实施方式及应用范围上均会有改变之处,综上所述,本说明书内容不应理解为对本申请的限制。The principles and implementations of the present application are described herein by using specific examples. The descriptions of the above embodiments are only used to help understand the methods and core ideas of the present application. There will be changes in the specific implementation and application scope. To sum up, the content of this specification should not be construed as a limitation on the application.

Claims (10)

1. A method for accessing a web page, comprising:
if the interface in the target webpage is detected to be failed to be called, recording a target url corresponding to the target webpage;
sending a login request to a first server; the webpage corresponding to the first server and the target webpage have different domain names;
and obtaining a token sent by the first server, and sending an access request to a second server corresponding to the target webpage by using the token and the target url so as to access the target webpage again.
2. The method for accessing a web page according to claim 1, wherein the sending an access request to a second server corresponding to the target web page by using the token and the target url includes:
generating an initial access request by using the target url;
and adding a token in the initial access request to obtain the access request, and sending the access request to the second server.
3. The method for accessing a web page according to claim 1, wherein the sending a login request to the first server comprises:
acquiring user name information and password information;
generating the login request by using the user name information and the password information;
and sending the login request to the first server so that the first server can verify the user name information and the password information, and responding to the login request by using the token after the verification is passed.
4. The method for accessing web pages according to claim 1, further comprising, after the obtaining the token sent by the first server:
and emptying a local cache and storing the token in the local cache.
5. The method for accessing a web page according to claim 1, wherein the recording a target url corresponding to the target web page comprises:
and recording the target url by using the referrer attribute.
6. The method for accessing web pages according to claim 1, wherein after the obtaining the token sent by the first server, before the sending an access request to the second server corresponding to the target web page by using the token and the target url, the method further comprises:
judging whether a skip url exists or not;
if the jump url does not exist, sending a default access request to the first server or the second server;
if the jump url exists, judging whether the jump url is the target url;
if the skip url is not the target url, sending the access request to the first server by using the skip url and the token;
and if the skip url is the target url, executing the step of sending an access request to a second server corresponding to the target webpage by using the token and the target url.
7. The method for accessing a web page according to claim 1, wherein the interface calls a failed detection process, comprising:
sending an interface calling request corresponding to a target interface on the target webpage to the second server;
judging whether the response content of the second server is an error code;
and if the response content is the error code, determining that the calling of the target interface in the target webpage fails.
8. A web page access apparatus, comprising:
the recording module is used for recording a target url corresponding to a target webpage if the failure of interface calling in the target webpage is detected;
the login module is used for sending a login request to the first server; the webpage corresponding to the first server and the target webpage have different domain names;
and the access module is used for acquiring the token sent by the first server and sending an access request to a second server corresponding to the target webpage by using the token and the target url so as to access the target webpage again.
9. A web page access device comprising a memory and a processor, wherein:
the memory is used for storing a computer program;
the processor is configured to execute the computer program to implement the web page access method according to any one of claims 1 to 7.
10. A computer-readable storage medium for storing a computer program, wherein the computer program when executed by a processor implements the web page access method of any one of claims 1 to 7.
CN202010996716.7A 2020-09-21 2020-09-21 A web page access method, apparatus, device and readable storage medium Withdrawn CN112100536A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202010996716.7A CN112100536A (en) 2020-09-21 2020-09-21 A web page access method, apparatus, device and readable storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202010996716.7A CN112100536A (en) 2020-09-21 2020-09-21 A web page access method, apparatus, device and readable storage medium

Publications (1)

Publication Number Publication Date
CN112100536A true CN112100536A (en) 2020-12-18

Family

ID=73754730

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202010996716.7A Withdrawn CN112100536A (en) 2020-09-21 2020-09-21 A web page access method, apparatus, device and readable storage medium

Country Status (1)

Country Link
CN (1) CN112100536A (en)

Cited By (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112612983A (en) * 2021-01-07 2021-04-06 上海哔哩哔哩科技有限公司 Page access method and system
CN113987392A (en) * 2021-09-29 2022-01-28 深圳融安网络科技有限公司 Webpage page control method and device and computer readable storage medium
CN114745196A (en) * 2022-04-27 2022-07-12 广域铭岛数字科技有限公司 Interface testing method, system, electronic device and readable storage medium
CN117234656A (en) * 2023-11-15 2023-12-15 苏州元脑智能科技有限公司 Method, system, equipment and storage medium for visual display of application
CN117370203A (en) * 2023-10-27 2024-01-09 华润数字科技有限公司 Automatic test method, system, electronic equipment and storage medium

Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN107359996A (en) * 2016-05-09 2017-11-17 阿里巴巴集团控股有限公司 Automatic logging method and device between more websites
CN111628965A (en) * 2020-04-03 2020-09-04 北京奇艺世纪科技有限公司 Cross-domain name login method and device

Patent Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN107359996A (en) * 2016-05-09 2017-11-17 阿里巴巴集团控股有限公司 Automatic logging method and device between more websites
CN111628965A (en) * 2020-04-03 2020-09-04 北京奇艺世纪科技有限公司 Cross-domain name login method and device

Cited By (9)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112612983A (en) * 2021-01-07 2021-04-06 上海哔哩哔哩科技有限公司 Page access method and system
CN112612983B (en) * 2021-01-07 2022-12-13 上海哔哩哔哩科技有限公司 Page access method and system
CN113987392A (en) * 2021-09-29 2022-01-28 深圳融安网络科技有限公司 Webpage page control method and device and computer readable storage medium
CN114745196A (en) * 2022-04-27 2022-07-12 广域铭岛数字科技有限公司 Interface testing method, system, electronic device and readable storage medium
CN114745196B (en) * 2022-04-27 2024-01-02 广域铭岛数字科技有限公司 Interface testing method, system, electronic device and readable storage medium
CN117370203A (en) * 2023-10-27 2024-01-09 华润数字科技有限公司 Automatic test method, system, electronic equipment and storage medium
CN117370203B (en) * 2023-10-27 2024-07-02 华润数字科技有限公司 Automatic test method, system, electronic equipment and storage medium
CN117234656A (en) * 2023-11-15 2023-12-15 苏州元脑智能科技有限公司 Method, system, equipment and storage medium for visual display of application
CN117234656B (en) * 2023-11-15 2024-02-20 苏州元脑智能科技有限公司 Method, system, equipment and storage medium for visual display of application

Similar Documents

Publication Publication Date Title
CN110324311B (en) Vulnerability detection method and device, computer equipment and storage medium
CN112100536A (en) A web page access method, apparatus, device and readable storage medium
CN112929326B (en) Malicious domain name access detection method and device and computer readable storage medium
CN109587133B (en) A single sign-on system and method
US9954855B2 (en) Login method and apparatus, and open platform system
JP6533871B2 (en) System and method for controlling sign-on to web applications
CN110888838B (en) Request processing method, device, equipment and storage medium based on object storage
KR20150040325A (en) Cloud-assisted method and service for application security verification
CN109039987A (en) A kind of user account login method, device, electronic equipment and storage medium
WO2016101635A1 (en) Method, apparatus and device for synchronizing login status, and computer storage medium
CN109948334B (en) Vulnerability detection method and system, electronic equipment and storage medium
JP2016533595A (en) Client download and installation method and apparatus
CN111106983B (en) Method and device for detecting network connectivity
CN109446801B (en) Method, device, server and storage medium for detecting simulator access
CN111259355A (en) Single sign-on method, portal system and service platform
CN108574721B (en) A login method, device and server, user terminal, and readable storage medium
RU2638779C1 (en) Method and server for executing authorization of application on electronic device
CN111818035A (en) Permission verification method and device based on API gateway
US12260212B2 (en) Disabling a script based on indications of unsuccessful execution of the script
CN114143047A (en) Vulnerability detection method and device, terminal equipment, Web server and storage medium
CN108322420B (en) Method and device for detecting backdoor file
CN111935107B (en) Identity authentication method, device, system, electronic equipment and storage medium
CN110633432A (en) Method, device, terminal equipment and medium for acquiring data
CN113434142A (en) Webpage output method, device, equipment and storage medium
CN110177096B (en) Client authentication method, device, medium and computing equipment

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
WW01 Invention patent application withdrawn after publication

Application publication date: 20201218

WW01 Invention patent application withdrawn after publication