Disclosure of Invention
The disclosure aims to provide a webpage access state determining method, device, storage medium and electronic equipment, so as to solve the problems in the related art.
To achieve the above object, according to a first aspect of embodiments of the present disclosure, there is provided a web page access state determining method, including:
creating a link label with a link target pointing to a specified webpage in the specified webpage accessed by a browser, so as to trigger the browser to conduct a target rendering process on the link label;
When the rendering value adopted by the browser is not consistent with the access state of the webpage pointed by the link target, the target rendering process is to render the link label twice, so that the rendering value of the link label by the browser is consistent with the access state of the webpage pointed by the link target, and when the rendering value adopted by the browser is consistent with the access state of the webpage pointed by the link target, the target rendering process is to render the link label once;
Modifying the link target of the link label into a target webpage, and triggering the browser to carry out the target rendering process on the link label again;
determining the number of times of rendering the link label in the current target rendering process;
and determining the access state of the target webpage according to the target times.
Optionally, the determining the number of times of rendering the link target in the currently performed target rendering process includes:
Monitoring the rendering time of each frame of the browser within a preset frame number;
determining a target frame number greater than a preset time threshold from the rendering time of each frame;
And determining the target times of rendering the link label in the target rendering process according to the target frame number.
Optionally, the number of the link labels is multiple, and the preset duration threshold and the preset frame number are positively correlated with the number of the link labels.
Optionally, the triggering the browser to perform the target rendering process on the link label again includes:
and triggering the browser to carry out the target rendering process on the link label again by adjusting the style attribute of the link label.
Optionally, the style attribute of the link tag is adjusted by:
adjusting the first style attribute of the link label from a first preset style value to a second preset style value;
and adjusting the first style attribute from the second preset style value back to the first preset style value.
Optionally, the target web page is multiple, and the modifying the link target of the link tag into the target web page includes:
And modifying the link target according to each target webpage in turn, wherein each modification of the link target is performed after the access state of the target webpage after the last modification is determined.
Optionally, the method further comprises:
and during the period that the browser accesses the appointed webpage, circularly executing the step of determining access states for a plurality of target webpages, wherein each circulation comprises the step of modifying the link targets according to each target webpage in turn.
Optionally, the creating a link label with a link target pointing to the specified web page in the specified web page includes:
Creating a link tag in the specified webpage, setting a link target of the link tag to point to the specified webpage, and setting a second style attribute of the link tag to be a third preset style value so that the link tag is invisible in the specified webpage.
Optionally, the method further comprises:
Responding to a browser to access a designated webpage, acquiring webpage information to be monitored sent by a website server corresponding to the designated webpage, and taking a webpage in the webpage information to be monitored as the target webpage;
The method further comprises the steps of:
and sending the access state of the target webpage to the website server.
According to a second aspect of embodiments of the present disclosure, there is provided a web page access state determining apparatus, the apparatus including:
the creation module is used for creating a link label with a link target pointing to the appointed webpage in the appointed webpage accessed by the browser so as to trigger the browser to carry out a target rendering process on the link label;
When the rendering value adopted by the browser is not consistent with the access state of the webpage pointed by the link target, the target rendering process is to render the link label twice, so that the rendering value of the link label by the browser is consistent with the access state of the webpage pointed by the link target, and when the rendering value adopted by the browser is consistent with the access state of the webpage pointed by the link target, the target rendering process is to render the link label once;
The modification module is used for modifying the link target of the link label into a target webpage and triggering the browser to carry out the target rendering process on the link label again;
The first determining module is used for determining the target times of rendering the link label in the currently performed target rendering process;
and the second determining module is used for determining the access state of the target webpage according to the target times.
According to a third aspect of embodiments of the present disclosure, there is provided a non-transitory computer readable storage medium having stored thereon a computer program which, when executed by a processor, implements the steps of the method of any of the first aspects described above.
According to a fourth aspect of embodiments of the present disclosure, there is provided an electronic device, comprising:
a memory having a computer program stored thereon;
a processor for executing the computer program in the memory to implement the steps of the method of any of the above first aspects.
By adopting the technical scheme, at least the following technical effects can be achieved:
In general, when a browser detects that a web page layout is changed or a web page style is changed, the browser may perform corresponding page rendering according to an access state of a link in a current web page. When the browser renders the link label, the browser firstly renders the link for the first time by adopting a rendering value of the rendering link label. And if the access state of the link is not consistent with the adopted rendering value through inquiring the database, updating the rendering value so that the updated rendering value is consistent with the access state of the link, and performing secondary rendering on the link according to the updated rendering value.
Thus, by creating a link tab in the specified web page with a link target pointing to the specified web page in response to detecting that the browser accesses the specified web page, the browser is triggered to perform a target rendering process on the created link tab using an event that causes a web page layout change. The target rendering flow is to render the link tag twice when the rendering value adopted by the browser is not consistent with the access state of the webpage pointed by the link target, so that the rendering value of the browser is consistent with the access state of the webpage pointed by the link target, and render the link tag once when the rendering value adopted by the browser is consistent with the access state of the webpage pointed by the link target. Thus, it is possible to ensure that the rendering value of the browser rendering link tab coincides with the accessed state of the specified web page according to the state in which the specified web page has been accessed by the user.
And under the condition that the rendering value of the rendering link label of the browser represents that the webpage link is accessed, modifying the link target of the created link label into a target webpage, and triggering the browser to conduct the target rendering process again by adjusting the style attribute of the link label. And determining the number of times of the target rendering of the link label in the current target rendering process according to the target rendering process carried out by the browser.
Since the current rendering value of the browser on the link tag coincides with the accessed state of the specified web page, if the target web page is not accessed (in this case, the rendering value of the browser does not coincide with the accessed state of the web page to which the link target of the link tag points), the number of times the link tag is rendered by the target rendering flow performed again is two. And if the target web page has been accessed (in this case, the rendering value of the browser matches the access state of the web page to which the link target of the link tag points), the number of times the link tag is rendered by the target rendering flow performed again is one. Therefore, the access state of the target webpage can be determined according to the target times, and the access behavior information of the user to the target webpage can be obtained without obtaining the style attribute of the link through the browser or installing the plug-in on the browser.
Additional features and advantages of the present disclosure will be set forth in the detailed description which follows.
Detailed Description
Specific embodiments of the present disclosure are described in detail below with reference to the accompanying drawings. It should be understood that the detailed description and specific examples, while indicating and illustrating the disclosure, are not intended to limit the disclosure.
It should be firstly noted that the technical solution provided by the embodiments of the present disclosure may be implemented under the condition of obtaining the authorization of the user. For example, when a user accesses a specified webpage through a browser, or when the user registers a user as the specified webpage, or when the user registers the specified webpage, or when the user logs in after finishing registering the specified webpage, the user is informed that the specified webpage will collect relevant user behavior information in the process of accessing the user by a mode of popup prompt boxes, a mode of directly displaying the specified webpage, or other modes, and the technical scheme provided by the embodiment of the disclosure is implemented after the user confirms authorization. The method, the device, the storage medium and the electronic equipment for determining the webpage access state provided by the embodiment of the disclosure are described in detail below.
FIG. 1 is a flowchart illustrating a method of determining a web page access status, according to an exemplary embodiment of the present disclosure, as shown in FIG. 1, the method comprising:
S101, creating a link label with a link target pointing to a specified webpage in the accessed specified webpage of the browser, so as to trigger the browser to conduct target rendering flow on the link label.
When the rendering value adopted by the browser is not consistent with the access state of the webpage pointed by the link target, the target rendering process is to render the link label twice, so that the rendering value of the link label by the browser is consistent with the access state of the webpage pointed by the link target, and when the rendering value adopted by the browser is consistent with the access state of the webpage pointed by the link target, the target rendering process is to render the link label once.
Step S101 may be, for example, to create a link tag in the specified web page with a link target pointing to the specified web page in response to the browser accessing the specified web page. Step S101 may also be, for example, to create a link tag in a specified web page to which a link target points in response to a user triggering a preset control in the specified web page that the browser has accessed. The preset control is, for example, a control for requesting the user to authorize the acquisition of the webpage access information, and the triggering operation of the user on the preset control may be a preset authorizing operation.
It should be appreciated that creating a link tab in a given web page may result in a web page layout change, triggering the browser to render the page again. In general, when detecting that the layout of the web page is changed or the style of the web page is changed, the browser may perform corresponding page rendering (i.e. the above-mentioned target rendering process) according to the access state of the link in the current web page. The target rendering process may specifically be:
When the browser renders the link in the page, firstly, rendering the link by using the rendering value of the rendering link label, and then if the access state of the link is not consistent with the rendering value adopted by inquiring a database (the database records the historical webpage access record of the user, and the website server corresponding to the appointed webpage cannot directly inquire the database to obtain the historical access record of the user), updating the rendering value to enable the updated rendering value to be consistent with the access state of the link, and performing secondary rendering on the link according to the updated rendering value. The rendering value is used for rendering the link label by the browser, the link label has different styles in different link access states, and the different styles are displayed by the browser by rendering the link according to the corresponding rendering value. Thus, the rendering value may characterize the web page link access state. For example, the corresponding link may be in a purple color, i.e., the browser renders the link in a purple color according to the rendering value, and the corresponding link may be in a blue color, i.e., the browser renders the link in a blue color according to the rendering value.
It can be understood that, after creating the link label with the link target pointing to the specified web page in the specified web page to trigger the browser to perform the target rendering process, the rendering value of the browser rendering link label coincides with the access state of the specified web page, that is, the rendering value of the browser rendering link label coincides with the accessed state of the specified web page.
S102, modifying the link target of the link label into a target webpage, and triggering the browser to conduct the target rendering process on the link label again.
Wherein modifying the link target of the link tag to the target web page may be accomplished by modifying a url (Uniform Resource Locators, uniform resource locator) address indicated by an href (Hypertext Reference ) attribute of the link tag to a link address of the target web page.
It should be noted that the mechanisms for rendering pages by different browsers are not necessarily the same. In specific implementation, the scheme can be adaptively modified according to rendering characteristics of different browsers. For example, for some browsers, modifying the link target to the target web page may trigger the browser to perform the target rendering process, while in other browsers, the browser may be triggered to perform the target rendering process by modifying the web page style or web page layout of the specified web page.
S103, determining the number of times of rendering the link label in the current target rendering process.
It should be noted that, in the process of triggering the browser to perform the target rendering process on the link label again, all frames rendered by the browser may include frames that the browser continuously performs page rendering along with the frequency of screen refreshing and frames that the browser performs rendering on the link label. Wherein, when the screen refresh frequency is 60Hz, the time length of the browser for rendering one frame along with the screen refresh is usually 16.7ms, and when the browser rendering is blocked due to the large link label rendering amount, the time length of the browser for rendering one frame is usually more than 16.7ms. Therefore, the frame rendered by the browser for the link tag can be determined by monitoring the rendering time of each frame in the target rendering flow by the browser. It should be understood that, for the rendering of the link tag by the browser, the access state of the link can be known by querying the database, so that one rendering or two renderings can be performed.
In order to distinguish the time of rendering one frame by the browser for the link label from the time of rendering one frame by the browser along with the frequency of screen refreshing, a plurality of link labels can be created when the link label of the link label pointing to the appointed webpage is created, and the link targets of the link labels are modified when the webpage pointed to by the link target of the link label is modified, or for a single link label, various style attributes of the single link label are modified, so that the time of rendering one frame by the browser for the link label is prolonged, and the judgment of the target times is more accurate.
S104, determining the access state of the target webpage according to the target times.
When the rendering value adopted by the browser is not consistent with the access state of the webpage pointed by the link target, the target rendering process is to render the link label twice, so that the rendering value of the link label by the browser is consistent with the access state of the webpage pointed by the link target, and when the rendering value adopted by the browser is consistent with the access state of the webpage pointed by the link target, the target rendering process is to render the link label once. Therefore, in the case that the specified web page has been determined to be accessed, and the rendering value of the browser for the link tag matches the accessed state of the specified web page, whether the rendering value is changed or not can be determined according to the target number of times, and further whether the access state of the target web page matches the access state of the specified web page is determined. That is, the access state of the target web page is determined to be accessed (consistent with the access state of the designated web page) when the target number is one rendering, and the access state of the target web page is determined to be not accessed (different from the access state of the designated web page) when the target number is two rendering.
According to the webpage access state determining method provided by the embodiment of the disclosure, the access state of the target webpage can be determined after the user accesses the designated webpage without acquiring the style attribute of the link through the browser or installing the plug-in on the browser.
In order to make it easier for those skilled in the art to understand the web page access state determining method provided in the present disclosure, the above steps are illustrated in detail below.
Optionally, the step S103 may specifically include:
monitoring the rendering time of each frame of the browser in a preset frame number;
determining a target frame number greater than a preset time threshold from the rendering time of each frame;
and determining the target times of rendering the link label in the target rendering process according to the target frame number.
Wherein the preset number of frames and the preset duration threshold are positively correlated to the number of linked tags, because the preset number of frames is related to the computing device capabilities running the browser, the rendering engine of the browser, etc. Wherein, for devices with relatively poor computing performance, the more linked tags, the longer the computing device executes the corresponding code. In this case, even if the browser is triggered to perform the target rendering process by adjusting the style attribute of the link tag, before the computing device does not execute the corresponding code for adjusting the style attribute of the link tag, the browser typically performs page rendering only in response to the screen refresh, and does not perform rendering once or twice according to the link access state until the computing device executes the corresponding code. Therefore, for a device with relatively poor computing performance, the larger the preset number of frames can be set relatively in practice.
It can be appreciated that the setting of the preset frame number may enable the browser to include, in frames rendered within the preset frame number, frames rendered by the target rendering process to the link tag, so as to determine, from the preset frame number, the target frame number capable of representing the number of times that the target rendering process renders the link tag.
In addition, the preset duration threshold is related to the computing device performance running the browser, the rendering engine of the browser, the length of the linked text, the screen refresh frequency, and so on. In the case that the screen refresh frequency is 60Hz, the preset duration threshold may be 16.7ms at minimum and may be set according to the number of link tags at maximum, regardless of other factors. Specifically, the more link labels, the longer the duration of rendering a frame by triggering the browser by adjusting the style attribute of the link labels. On the basis, the preset duration threshold value is not more than the duration of triggering the browser to render one frame by adjusting the style attribute of the link label at maximum. Since the influence factors of the preset time period threshold are numerous, the preset time period threshold may be set larger, for example, 60ms, in order to reduce the judgment error. In a specific implementation, the preset duration threshold may be set according to an actual situation, which is not specifically limited in the disclosure.
The rendering time length can be determined by specifically monitoring the rendering time length of each frame of the browser within a preset frame number through callback requestAnimationFrame functions in a designated webpage. Wherein requestAnimationFrame functions are typically invoked by the browser before page rendering of each frame. Since the browser usually performs page rendering along with the frequency of screen refreshing when invoking requestAnimationFrame functions, adjusting the link tag of the target webpage may cause loading blocking of CSS (CASCADING STYLE SHEETS, cascading style sheet) or JS (JavaScript, scripting language), thereby causing the browser to extend the rendering time of at least one frame of page. Therefore, when it is determined that the browser renders the duration of one frame of page (namely, the preset duration threshold value) under the condition that the browser does not have any loading blocking or other conditions for prolonging the page rendering duration, the target frame number for triggering the browser to render the page by adjusting the link label of the target webpage can be determined, and the rendering duration of each frame in the target frame number is greater than the preset duration threshold value.
In the present disclosure, the rendering duration of each frame within the preset frame number may be obtained by subtracting the time of the previous frame callback requestAnimationFrame function from the time of the current frame callback requestAnimationFrame function, and determining a target frame number greater than the preset rendering duration from the rendering duration of each frame. It can be appreciated that the browser may render a frame as one rendering, that is, the number of times the link label is rendered in the target rendering process may be determined according to the number of target frames.
Optionally, the manner of triggering the browser to perform the target rendering process on the link label may include:
in one mode, style attributes of the link tag are adjusted.
The method includes the steps of adjusting a first style attribute of a link label from a first preset style value to a second preset style value, and adjusting the first style attribute from the second preset style value back to the first preset style value.
It will be appreciated that adjusting the style properties of the link tab may trigger the browser to perform the target rendering process. The link tag has a plurality of attributes, such as id for uniquely identifying an HTML (HyperText Markup Language ) element, title for describing additional information of the HTML element, style (style) for specifying a style of the HTML element, and the like, wherein modifying the attribute such as id or title does not trigger the browser to render a page, and modifying the style attribute can change the appearance of the HTML element, so that the browser can be triggered to render a page.
When the page is rendered, if some webpage styles are specified in the resource file of the page, the page rendering is preferentially performed according to the resource file of the page, and if the styles of some HTML elements in the page are not specified in the resource file of the page, the corresponding HTML elements are rendered according to the style values preset by the browser. Therefore, the browser can render the page according to the resource file of the specified webpage by adjusting the first style attribute of the link tag from the first preset style value to the second preset style value, wherein the first style attribute can be a color (color) attribute, a text-modifying (text-decoration) attribute and the like of the link tag, and the first preset style value can be the style value preset by the browser. Accordingly, the browser can render the corresponding HTML element according to the preset style value by adjusting the first style attribute from the second preset style value back to the first preset style value.
In some embodiments, the operation of adjusting the first style attribute of the link tag from the first preset style value to the second preset style value can be realized by the JS code adding the first style attribute of the link tag to the second preset style value in the CSS resource file of the initial webpage, and the operation of adjusting the first style attribute from the second preset style value back to the first preset style value can be realized by the JS code deleting the second preset style value in the CSS resource file or setting the second preset style value to a null value. In other embodiments, the second preset style value may be preset in the CSS resource file of the specified web page, and the second preset style value is set to be not matched with the link tag, so that the operation of adjusting the first style attribute of the link tag from the first preset style value to the second preset style value may be implemented by setting the second preset style value to be matched with the link tag through the JS code, and the operation of adjusting the first style attribute from the second preset style value back to the first preset style value may be implemented by setting the second preset style value to be not matched with the link tag again through the JS code.
Specifically, taking the color attribute as an example, the first style attribute of the link label may be adjusted as follows:
{style.color=“red”;
style.color=“”}
firstly, setting the color attribute of the link label to be red, and then setting the color attribute to be a null value so as to trigger the browser to render the link label according to a preset style value.
It may be appreciated that the first style attribute of the link label may also be adjusted in other manners to trigger the browser to perform the target rendering process on the link label again, which is not specifically limited in this disclosure.
And secondly, adjusting style attributes of other HTML elements except the created link label in the appointed webpage.
For example, after determining the webpage function of the specified webpage, the HTML element existing in the specified webpage before creating the link tag may be determined, so that after modifying the link target in the link tag to the target webpage, the browser is triggered to render the webpage by modifying the HTML element existing in the specified webpage. Or creating an HTML element (such as a block tag < div >) except the link tag, taking the created link tag as the content of the HTML element (namely, taking the link tag as a sub-tag of the HTML element), and triggering the browser to perform page rendering by modifying the HTML element. Specifically, taking the block tag < div > as an example, the link tag as a sub-tag of the block tag may be as follows:
< div > < ahref= "url" > link text </div >
It should be noted that the timing of starting the callback requestAnimationFrame function in a given web page may affect the number of target frames.
In some embodiments, the callback requestAnimationFrame function is started after the first style attribute of the link tag is adjusted from the first preset style value to the second preset style value, so as to monitor the duration of rendering each frame by the browser. In this case, the callback requestAnimationFrame function will monitor the duration of one frame rendered by the browser according to the second preset style value, and then monitor the duration of the rendered frame of the link tag by the target rendering process started after the first style attribute is adjusted from the second preset style value to the first preset style value, that is, the target frame number is two frames or three frames. In this case, when the target frame number is two frames, the access state of the target webpage is consistent with the rendering value before the browser renders the link label of the target webpage, that is, the target number of times that the browser renders the link label in the target rendering process is one, and when the target frame number is three frames, the access state of the target webpage is inconsistent with the rendering value before the browser renders the link label of the target webpage, that is, the target number of times that the browser renders the link label in the target rendering process is two.
In other embodiments, the callback requestAnimationFrame function begins after the first style attribute is adjusted from the second preset style value back to the first preset style value to monitor the duration of rendering each frame by the browser. In this case, the callback requestAnimationFrame function directly listens to the duration of the frame rendered by the target rendering process to the link tag. In this case, when the target frame number is one frame, the access state of the target webpage is consistent with the rendering value before the browser renders the link label of the target webpage, that is, the target number of times that the browser renders the link label in the target rendering process is one time, and when the target frame number is two frames, the access state of the target webpage is inconsistent with the rendering value before the browser renders the link label of the target webpage, that is, the target number of times that the browser renders the link label in the target rendering process is two times.
It can be understood that in the process of monitoring the duration of rendering each frame by the browser, there may be other factors affecting the target frame number, and no matter what affecting factor is, in the case that the rendering value adopted by the browser does not coincide with the access state of the web page pointed by the link target, the target frame number of the link tag rendered by the browser should be one frame more than in the case that the rendering value adopted by the browser coincides with the access state of the web page pointed by the link target, and the target frame number of one frame more indicates that the target number of times of rendering the link tag by the browser in the target rendering flow is two times.
Optionally, the target web page is multiple, and the modifying the link target of the link tag into the target web page includes:
And modifying the link target according to each target webpage in turn, wherein each modification of the link target is performed after the access state of the target webpage after the last modification is determined.
In a possible implementation, the link address of the target web page may be obtained from the web server corresponding to the specified web page.
For example, the method provided by the embodiment of the present disclosure may obtain, in response to a browser accessing a specified web page, web page information to be monitored sent by a web server corresponding to the specified web page, and use a web page in the web page information to be monitored as the target web page.
The webpage information to be monitored can comprise a link of a webpage to be monitored, or a link list formed by a plurality of webpage links to be monitored, and the webpage to be monitored in the webpage information to be monitored can be used as a target webpage in sequence by sequentially modifying the 'href' attribute of the link label into the target link in the link list, so that the access state of each webpage to be monitored in the link list is sequentially determined.
It should be noted that the status determination of each target web page depends on the determined access status of the previous web page (the previous web page of the first target web page is the designated web page). It can be appreciated that when the access state of any target web page is determined, the current rendering value of the link tag by the browser is consistent with the access state of the target web page. Thus, when determining the access state for the next target web page of the target web page, if the above-mentioned target frame number determined for the next target web page is twice, it is indicated that the access state of the next target web page of the target web page is inconsistent with the access state of the target web page, and if the target number is once, it is indicated that the access state of the next target web page of the target web page is consistent with the access state of the target web page. Therefore, in the case where there are a plurality of target web pages, the determination of the access status of any one of the target web pages may be determined based on the access status of the previous target web page and the number of target times, in addition to the first target web page (the previous web page of the first target web page is a designated web page whose access status is known).
Table 1 shows the access status determination result for 5 target web pages, taking 5 target web pages, 8 preset frames, 60ms preset time length, and starting to monitor the time length of rendering each frame by the browser after adjusting the first style attribute from the second preset style value to the first preset style value as an example.
TABLE 1
It can be understood that after creating the link tag and directing the link target of the link tag to the link address of the designated web page and triggering the browser to perform the first target rendering process on the link tag, the rendering value of the browser on the link tag matches the accessed state of the designated web page. On the basis, the url address of the link label can be modified into a target link address (namely the link address 1 in table 1), the browser is triggered to perform the target rendering process again, the rendering time of each frame in the preset frame number is monitored by the browser, the target frame number which is greater than 60ms is determined to be 1 frame from the rendering time of each frame, the number of times of rendering the link label in the current target rendering process is determined to be 1, namely the rendering value adopted by the browser accords with the access state of the link address 1, and then the link address 1 is determined to be accessed.
Under the condition that the link address 1 is accessed, the url address of the link label can be modified to be the next target link address (namely the link address 2 in table 1), and the target frame number greater than 60ms is determined to be 2 frames from each frame rendering time in the same manner, so that the number of times of rendering the link label in the current target rendering process is determined to be 2, namely the rendering value adopted by the browser is not consistent with the access state of the link address 2, and further the link address 2 is determined to be not accessed. After triggering the browser to perform the target rendering process again, the rendering value of the browser is updated to be consistent with the access state of the link address 2.
And by analogy, after the access state of the target webpage after the last modification is determined, sequentially modifying the link target according to the target link address, and triggering the browser to perform the target rendering process again, so as to determine the access state of the target webpage pointed by the target link each time.
Optionally, the method provided by the embodiment of the present disclosure may further include:
And during the period that the browser accesses the appointed webpage, circularly executing the step of determining access states for a plurality of target webpages, wherein each circle comprises the step of modifying the link targets according to each target webpage in turn.
Still taking table 1 as an example, after determining the access state corresponding to the link address 5, the link destination of the link tag may be set to the link address 1 again to implement the loop. Therefore, whether the browser accesses each target webpage or not in the whole process of accessing the appointed webpage can be determined.
Optionally, the method provided by the embodiment of the present disclosure may further include:
and sending the access state of the target webpage to a website server.
In the specific implementation process, under the condition that the access states of a plurality of target webpages are determined, the access state of one target webpage can be fed back to a website server corresponding to the appointed webpage after the access state of the target webpage is determined, or after the access state of each target webpage is determined in each cycle, the access states of all the target webpages are returned to the website server, so that the website server analyzes the user behaviors according to the access state information and characterizes user figures and the like.
Optionally, creating a link tag in the specified web page with a link target pointing to the specified web page may include:
Creating a link tag in the specified web page, setting a link target of the link tag to point to the specified web page, and setting a second style attribute of the link tag to be a third preset style value so that the link tag is invisible in the specified web page.
Specifically, the link label of the link target pointing to the specified webpage can be created in the specified webpage through the JS code, and the user is prevented from perceiving the creation and subsequent modification of the link label by setting the second style attribute of the link label to be a third preset style value so that the link label is invisible, so that the experience of browsing the specified webpage by the user is improved. Wherein, when the link label is completely invisible, adjusting the style attribute of the link label does not trigger the browser to render, so that the link label is invisible can mean that the link label is almost invisible. The second style attribute is used to characterize an attribute that may make the link label nearly invisible, and may be a plurality of different style attributes, such as transparency (opacity), position (position), and stacking order (z-index). Wherein the z-index attribute sets the stacking order of elements, and elements with higher stacking order will always be in front of elements with lower stacking order. Accordingly, the third preset style value may have a different value corresponding to the second style attribute, which is different, for example, the corresponding transparency may be 0.01, and the corresponding stacking order may be-10.
Specifically, style attributes of the link tag may be set as follows:
{opacity:0.01;
float:right;
position:absolute;
z-index:-10}
Wherein the transparency of the link label is set to 0.01, the position is fixed on the right side of the specified web page, the stacking order is-10, in which case the link label is in a state of almost invisible. Since the link text length of the link tag is generally longer, the text of the link tag may also be replaced with smaller characters, such as ", and". By setting the second style property of the link tag, and in combination with replacing the link text, an effect may be achieved that the link tag is hardly visible to the user on the specified web page.
By adopting the method, the browser does not need to acquire the style attribute of the link, and the plug-in is not required to be installed in the browser, after the user accesses the appointed webpage, the link label is created in the appointed webpage based on the accessed state of the appointed webpage to determine the rendering value of the browser for rendering the link, so that the link targets of the link labels are modified, the style attribute of the link labels of different webpages are modified one by one in the appointed webpage to trigger the browser to perform the target rendering process again, the target number of times of rendering the link labels in the target rendering process performed this time is determined according to the target rendering process performed by the browser, and the access state of the target webpage is determined according to the target number of times.
Based on the same inventive concept, the present disclosure further provides a web page access state determining apparatus, referring to fig. 2, fig. 2 is a block diagram of a web page access state determining apparatus according to an exemplary embodiment of the present disclosure, and as shown in fig. 2, the web page access state determining apparatus 100 includes:
The creation module 101 is configured to create a link tag with a link target pointing to a specified web page accessed by a browser in the specified web page, so as to trigger the browser to perform a target rendering process on the link tag;
When the rendering value adopted by the browser is not consistent with the access state of the webpage pointed by the link target, the target rendering process is to render the link label twice, so that the rendering value of the link label by the browser is consistent with the access state of the webpage pointed by the link target, and when the rendering value adopted by the browser is consistent with the access state of the webpage pointed by the link target, the target rendering process is to render the link label once;
the modification module 102 is configured to modify the link target of the link tag into a target webpage, and trigger the browser to perform the target rendering process on the link tag again;
A first determining module 103, configured to determine a target number of times of rendering the link label in the currently performed target rendering process;
and the second determining module 104 is configured to determine an access state of the target webpage according to the target times.
The webpage access state determining device provided by the embodiment of the disclosure can determine the access state of the target webpage after the user accesses the designated webpage without acquiring the style attribute of the link through the browser or installing the plug-in on the browser.
Optionally, the first determining module 103 is further configured to:
Monitoring the rendering time of each frame of the browser within a preset frame number;
determining a target frame number greater than a preset time threshold from the rendering time of each frame;
And determining the target times of rendering the link label in the target rendering process according to the target frame number.
Optionally, the number of the link labels is multiple, and the preset duration threshold and the preset frame number are positively correlated with the number of the link labels.
Optionally, the modification module 102 is further configured to:
and triggering the browser to carry out the target rendering process on the link label again by adjusting the style attribute of the link label.
Optionally, the modification module 102 is further configured to:
adjusting the first style attribute of the link label from a first preset style value to a second preset style value;
and adjusting the first style attribute from the second preset style value back to the first preset style value.
Optionally, the target web page is multiple, and the modification module 102 is further configured to:
And modifying the link target according to each target webpage in turn, wherein each modification of the link target is performed after the access state of the target webpage after the last modification is determined.
Optionally, the apparatus 100 further comprises:
and the execution module is used for circularly executing the step of determining the access state of a plurality of target webpages during the period that the browser accesses the appointed webpages, wherein each cycle comprises the step of modifying the link target according to each target webpage in turn.
Optionally, the creation module 101 is further configured to:
Creating a link tag in the specified webpage, setting a link target of the link tag to point to the specified webpage, and setting a second style attribute of the link tag to be a third preset style value so that the link tag is invisible in the specified webpage.
Optionally, the apparatus 100 further comprises:
the acquisition module is used for responding to the browser to access the appointed webpage, acquiring webpage information to be monitored sent by a website server corresponding to the appointed webpage, and taking the webpage in the webpage information to be monitored as the target webpage.
Optionally, the apparatus 100 further comprises:
And the sending module is used for sending the access state of the target webpage to the website server.
The specific manner in which the various modules perform the operations in the apparatus of the above embodiments have been described in detail in connection with the embodiments of the method, and will not be described in detail herein.
Based on the same inventive concept, the embodiments of the present disclosure also provide a non-transitory computer-readable storage medium having stored thereon a computer program which, when executed by a processor, implements the steps of the above-described web page access state determination method.
In particular, the computer readable storage medium may be a flash memory, a hard disk, a multimedia card, a card memory (e.g., SD or DX memory, etc.), a Random Access Memory (RAM), a Static Random Access Memory (SRAM), a read-only memory (ROM), an electrically erasable programmable read-only memory (EEPROM), a programmable read-only memory (PROM), a magnetic memory, a magnetic disk, an optical disk, a server, a public cloud server, etc.
With respect to the computer-readable storage medium in the above-described embodiments, the steps of implementing the web page access state determination method when the computer program stored thereon is executed have been described in detail in the embodiments related to the method, and will not be described in detail herein.
Based on the same inventive concept, the embodiments of the present disclosure further provide an electronic device, including:
a memory having a computer program stored thereon;
and the processor is used for executing the computer program in the memory to realize the steps of the webpage access state determining method.
Fig. 3 is a block diagram of an electronic device 200, shown in accordance with an exemplary embodiment. As shown in fig. 3, the electronic device 200 may include a processor 201 and a memory 202. The electronic device 200 may also include one or more of a multimedia component 203, an input/output (I/O) interface 204, and a communication component 205.
The processor 201 is configured to control the overall operation of the electronic device 200 to complete all or part of the steps in the above-described method for determining a web page access status. The memory 202 is used to store various types of data to support operation at the electronic device 200, which may include, for example, instructions for any application or method operating on the electronic device 200, as well as application-related data, such as contact data, messages sent and received, pictures, audio, video, and so forth. The Memory 202 may be implemented by any type or combination of volatile or non-volatile Memory devices, such as static random access Memory (Static Random Access Memory, SRAM for short), electrically erasable programmable Read-Only Memory (ELECTRICALLY ERASABLE PROGRAMMABLE READ-Only Memory, EEPROM for short), erasable programmable Read-Only Memory (Erasable Programmable Read-Only Memory, EPROM for short), programmable Read-Only Memory (Programmable Read-Only Memory, PROM for short), read-Only Memory (ROM for short), magnetic Memory, flash Memory, magnetic disk, or optical disk. The multimedia component 203 may include a screen and an audio component. Wherein the screen may be, for example, a touch screen, the audio component being for outputting and/or inputting audio signals. For example, the audio component may include a microphone for receiving external audio signals. The received audio signals may be further stored in the memory 202 or transmitted through the communication component 205. The audio assembly further comprises at least one speaker for outputting audio signals. The I/O interface 204 provides an interface between the processor 201 and other interface modules, which may be a keyboard, mouse, buttons, etc. These buttons may be virtual buttons or physical buttons. The communication component 205 is used for wired or wireless communication between the electronic device 200 and other devices. Wireless Communication, such as Wi-Fi, bluetooth, near Field Communication (NFC) for short, 2G, 3G, 4G or 5G, nb-IOT (Narrow Band Internet of Things ), or a combination of one or more thereof, so the corresponding Communication component 205 may comprise a Wi-Fi module, a bluetooth module, an NFC module.
In an exemplary embodiment, the electronic device 200 may be implemented by one or more Application Specific Integrated Circuits (ASIC), digital signal Processor (DIGITAL SIGNAL Processor, DSP), digital signal processing device (DIGITAL SIGNAL Processing Device, DSPD), programmable logic device (Programmable Logic Device, PLD), field programmable gate array (Field Programmable GATE ARRAY, FPGA), controller, microcontroller, microprocessor, or other electronic component for performing the above-described web page access state determining method.
The preferred embodiments of the present disclosure have been described in detail above with reference to the accompanying drawings, but the present disclosure is not limited to the specific details of the embodiments described above, and various simple modifications may be made to the technical solutions of the present disclosure within the scope of the technical concept of the present disclosure, and all the simple modifications belong to the protection scope of the present disclosure.
In addition, the specific features described in the foregoing embodiments may be combined in any suitable manner, and in order to avoid unnecessary repetition, the present disclosure does not further describe various possible combinations.
Moreover, any combination between the various embodiments of the present disclosure is possible as long as it does not depart from the spirit of the present disclosure, which should also be construed as the disclosure of the present disclosure.