Disclosure of Invention
The embodiment of the invention provides a method for determining a webpage access address, which solves the technical problem that the content of the webpage presented before and after the existing webpage access address is shared is different.
In a first aspect, an embodiment of the present invention provides a method for determining a web page access address, including:
when detecting that the current subframe of the current access webpage is in an open state due to the response of the jump action of the parent frame, determining the access address of the current access webpage after the parent frame jumps, wherein the access address carries the address of the current subframe in the open state;
when the fact that the current subframe in the parent frame of the current access page jumps is detected, the access address of the current access webpage is updated according to the address of the current subframe after the jump, and the access address comprises the address of the current subframe after the jump.
In a second aspect, an embodiment of the present invention further provides a device for determining a web page access address, where the device includes:
the first module is used for determining the access address of the current access webpage after the parent frame skips when detecting that the current subframe of the current access webpage is in an open state due to the skip action of the parent frame in response, and the access address carries the address of the current subframe in the open state;
and the second module is used for updating the access address of the current access webpage according to the address of the current subframe after the jump when the jump of the current subframe in the parent frame of the current access webpage is detected, and the access address comprises the address of the current subframe after the jump.
In a third aspect, an embodiment of the present invention further provides an electronic device, where the electronic device includes:
one or more processors;
storage means for storing one or more programs;
when executed by the one or more processors, cause the one or more processors to implement a method for determining a web page access address as in any embodiment.
In a fourth aspect, the present invention further provides a storage medium containing computer-executable instructions, which when executed by a computer processor, are configured to perform the method for determining a web page access address according to any of the embodiments.
According to the technical scheme of the method for determining the webpage access address, when the situation that the current subframe of the current access webpage is in an open state due to the fact that the current subframe responds to the jump action of the parent frame is detected, the access address of the current access webpage after the parent frame jumps is determined, and the access address carries the address of the current subframe in the open state; when the fact that the current subframe in the parent frame of the current access page jumps is detected, the access address of the current access webpage is updated according to the address of the current subframe after the jump, and the access address comprises the address of the current subframe after the jump. Compared with the prior art, the access address of the access page is updated in real time along with the jump of the parent frame and/or the child frame, so that the corresponding parent frame and child frame contents can be displayed after the access address is shared, namely the displayed contents before and after the access address is shared are the same; and when the access page is operated to move forward, move backward and the like, the corresponding display content can be accurately output instead of directly returning to the corresponding home page, and the page access and sharing experience of the user can be improved.
Detailed Description
In order to make the objects, technical solutions and advantages of the present invention clearer, the technical solutions of the present invention will be clearly and completely described through embodiments with reference to the accompanying drawings in the embodiments of the present invention, and it is obvious that the described embodiments are some, but not all, embodiments of the present invention. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present invention.
Example one
Fig. 1 is a flowchart of a method for determining a web page access address according to an embodiment of the present invention. The technical scheme of the embodiment is suitable for the situation that the content of the page presented before and after the access address of the webpage is shared is not changed by synchronizing the addresses of the parent frame and the child frame of the webpage to the access address of the webpage in real time. The method can be executed by the device for determining the webpage access address provided by the embodiment of the invention, and the device can be realized in a software and/or hardware manner and is configured to be applied in a processor. The method specifically comprises the following steps:
s101, when it is detected that the current subframe of the current access webpage is in an open state due to the jump action of the parent frame in response, determining an access address of the current access webpage after the parent frame jumps, wherein the access address carries the address of the current subframe in the open state.
It can be understood that, since the access address of the currently accessed webpage carries the address of the current subframe in the open state, when the access address of the currently accessed webpage is shared to other people, the page content displayed by the shared access address to other people is the same as the page content seen by the user when the user shares the page content.
The address of the parent frame is an access address of a current access page, namely the access address in the address bar of the browser, and the address of the subframe carries the iframe address of the subframe.
Wherein, the current subframe in the open state in response to the jump action of the parent frame can be understood as the default subframe corresponding to the jump action of the parent frame. Illustratively, the currently accessed page comprises two parent frames, the user is currently browsing the parent frame a, and after the user finishes browsing the parent frame a, clicking the parent frame B, the current parent frame of the currently accessed page jumps from the parent frame a to the parent frame B, and the display content of the default child frame B1 of the parent frame B is output. The subframe B1 is the current subframe that is open in response to the jump action of the parent frame.
In this embodiment, the domain names of all subframes included in any parent frame are the same.
In one embodiment, when a parent frame of a current access page is detected to jump, the address of the parent frame is obtained, and the domain name of a subframe contained in the parent frame is determined according to the address of the parent frame. Specifically, the first-level relative path of the parent frame is taken as the domain name of each subframe it contains.
In one embodiment, when a parent frame of a currently accessed page is detected to jump, the address of the parent frame is obtained, and the address of the current subframe in an open state is determined according to the address of the parent frame. Specifically, the control parent framework sends the self address to the current subframe in the open state based on a preset cross-domain communication method, so that the subframe maps the first-level relative path of the address of the parent framework to the domain name of the self address, and modifies the self address by using a history.
The preset cross-domain communication method is a standard window. In this embodiment, an UpdateURL class is defined, and origin uses the "+" mark to represent that the domain names of the parent frame and the child frame are not checked. The UpdateURL class contains a URL address that identifies the synchronization with a URL attribute. When the parent frame synchronizes addresses to the child frame, i.e., when the address of the current child frame in the open state in response to the jump action of the parent frame is determined from the parent frame address, url is the address of the parent frame, i.e., the address displayed in the browser address bar.
In this embodiment, when the parent frame jumps, the parent frame sends a message through a window. The following are exemplary: the address of the parent frame X is: https: com/xxx/index, the corresponding default subframe is subframe X1 with the address: https: com/index; the address of the parent frame Y is: https: com/yy/index, corresponding to the default subframe as subframe Y1 with the address: https: com/index. If the parent frame of the currently accessed webpage is a parent frame X, and the default subframe of the parent frame X is a subframe X1; when the parent framework jumps from the parent framework X to the parent framework Y, the parent framework Y is controlled to carry out https: com/yy/index is sent to the current subframe, subframe Y1, via window. Com/yy/index modifies the self address to https: com/index. Thus, at the address of the parent frame Y, namely the access address https of the corresponding web page: com/yy/index is shared, and when the browser opens the shared access address, the browser can access the shared access address through https: com/index calls and displays subframe Y1 so that the display content of subframe Y1 can be accurately output.
The method for acquiring the address of the skipped parent frame comprises the following steps: acquiring the address of a parent frame of a current access page generated by the first loading action of the browser by monitoring the loading event of the browser; acquiring the address of a parent frame of a skipped SPA (Single Page Web application, SPA for short) architecture webpage through the history. And monitoring a pop state event of the browser to obtain the address of the parent frame of the SPA architecture webpage generated by forward or backward.
S102, when it is detected that the current subframe in the parent frame of the current access page jumps, updating the access address of the current access webpage according to the address of the jumped current subframe, wherein the access address comprises the address of the jumped current subframe.
When detecting that the current subframe in the parent frame of the current access page jumps, determining the address of the jumped subframe, and updating the access address of the current access page according to the address of the jumped subframe.
In one embodiment, after detecting the jump of the current subframe in the current parent frame, the address of the current subframe after the jump is determined according to the domain name of the subframe contained in the current parent frame determined in the previous step and the iframe address of the current subframe after the jump.
After the address of the current subframe is determined, synchronizing the address of the current subframe to the parent frame where the current subframe is located, specifically: and controlling the skipped current subframe to send the address of the current subframe to the parent frame where the current subframe is located based on a preset cross-domain communication method, so that the parent frame updates the address of the current subframe according to the received address, namely, the access address of the current access page is updated. Because the access address of the current access page is updated based on the address of the current subframe, the access address carries the address of the current subframe, and therefore, after the access address is shared, the display content of the current subframe can still be displayed, namely, the display content presented before and after the access address is shared is the same, and the user experience is better.
The preset cross-domain communication method is a method for performing cross-domain communication based on window. After determining the address of the current subframe, the subframe sends its own address to the parent frame through window.
According to the technical scheme of the method for determining the webpage access address, when the situation that the current subframe of the current access webpage is in an open state due to the fact that the current subframe responds to the jump action of the parent frame is detected, the access address of the current access webpage after the parent frame jumps is determined, and the access address carries the address of the current subframe in the open state; when the fact that the current subframe in the parent frame of the current access page jumps is detected, the access address of the current access webpage is updated according to the address of the current subframe after the jump, and the access address comprises the address of the current subframe after the jump. Compared with the prior art, the access address of the access page is updated in real time along with the jump of the parent frame and/or the child frame, so that the corresponding parent frame and child frame contents can be displayed after the access address is shared, namely the displayed contents before and after the access address is shared are the same; and when the access page is operated to move forward, move backward and the like, the corresponding display content can be accurately output instead of directly returning to the corresponding home page, and the page access and sharing experience of the user can be improved.
Example two
Fig. 2 is a block diagram of a device for determining a web page access address according to an embodiment of the present invention. The device is used for executing the method for determining the webpage access address provided by any of the above embodiments, and the device can be implemented by software or hardware. The device includes:
the first module is used for determining the access address of the current access webpage after the parent frame skips when detecting that the current subframe of the current access webpage is in an open state due to the skip action of the parent frame in response, and the access address carries the address of the current subframe in the open state;
and the second module is used for updating the access address of the current access webpage according to the address of the current subframe after the jump when the jump of the current subframe in the parent frame of the current access webpage is detected, and the access address comprises the address of the current subframe after the jump.
Preferably, the first module includes a domain name determining unit, configured to determine the domain name of the subframe included in the current parent frame according to the address of the current parent frame.
Preferably, the first module further comprises a subframe address determining unit, configured to control the parent frame to send the self address to the current subframe in the open state based on a preset cross-domain communication method, so that the subframe maps the first-level relative path of the address of the parent frame to the domain name of the self address to obtain the corresponding address.
Preferably, the second module is configured to, when it is detected that a current subframe in a parent frame of the current access page jumps, determine an address of the current subframe after the jump, and update the access address of the current access webpage according to the address of the current subframe after the jump.
Preferably, the second module sends the address of the second module to the parent frame where the second module is located, based on the preset cross-domain communication method, so that the parent frame updates the access address of the current access page according to the received address.
Preferably, the parent frame address acquisition unit is further configured to acquire an address of a parent frame of a currently visited page generated by a first loading action of the browser by listening to a loading event of the browser.
Preferably, the first module further includes a parent frame address obtaining unit, where the parent frame address determining unit is configured to obtain, through history. And acquiring the address of the parent frame of the SPA framework webpage generated by forward or backward by monitoring a pop state event of the browser.
According to the technical scheme of the device for determining the webpage access address, when the fact that the current subframe of the current access webpage is in the open state due to the fact that the current subframe responds to the jump action of the parent frame of the current access webpage is detected through a first module, the access address of the current access webpage after the parent frame jumps is determined, and the access address carries the address of the current subframe in the open state; when the second module detects that the current subframe in the parent frame of the current access page jumps, the access address of the current access webpage is updated according to the address of the current subframe after the jump, and the access address comprises the address of the current subframe after the jump. Compared with the prior art, the access address of the access page is updated in real time along with the jump of the parent frame and/or the child frame, so that the corresponding parent frame and child frame contents can be displayed after the access address is shared, namely the displayed contents before and after the access address is shared are the same; and when the access page is operated to move forward, move backward and the like, the corresponding display content can be accurately output instead of directly returning to the corresponding home page, and the page access and sharing experience of the user can be improved.
The device for determining the webpage access address provided by the embodiment of the invention can execute the method for determining the webpage access address provided by any embodiment of the invention, and has corresponding functional modules and beneficial effects of the execution method.
EXAMPLE III
Fig. 3 is a schematic structural diagram of an electronic apparatus according to an embodiment of the present invention, as shown in fig. 3, the electronic apparatus includes aprocessor 201, amemory 202, aninput device 203, and anoutput device 204; the number of theprocessors 201 in the device may be one or more, and oneprocessor 201 is taken as an example in fig. 3; theprocessor 201, thememory 202, theinput device 203 and theoutput device 204 in the apparatus may be connected by a bus or other means, and fig. 3 illustrates the connection by a bus as an example.
Thememory 202, which is a computer-readable storage medium, may be used for storing software programs, computer-executable programs, and modules, such as program instructions/modules (e.g., thefirst module 11 and the second module 12) corresponding to the method for determining a web page access address in the embodiment of the present invention. Theprocessor 201 executes various functional applications and data processing of the device by executing software programs, instructions and modules stored in thememory 202, that is, the method for determining the web page access address is implemented.
Thememory 202 may mainly include a storage program area and a storage data area, wherein the storage program area may store an operating system, an application program required for at least one function; the storage data area may store data created according to the use of the terminal, and the like. Further, thememory 202 may include high speed random access memory, and may also include non-volatile memory, such as at least one magnetic disk storage device, flash memory device, or other non-volatile solid state storage device. In some examples, thememory 202 may further include memory located remotely from theprocessor 201, which may be connected to the device over a network. Examples of such networks include, but are not limited to, the internet, intranets, local area networks, mobile communication networks, and combinations thereof.
Theinput device 203 may be used to receive input numeric or character information and generate key signal inputs related to user settings and function controls of the apparatus.
Theoutput device 204 may include a display device such as a display screen, for example, of a user terminal.
Example four
Embodiments of the present invention also provide a storage medium containing computer-executable instructions, which when executed by a computer processor, perform a method for determining a web page access address, the method including:
when detecting that the current subframe of the current access webpage is in an open state due to the response of the jump action of the parent frame, determining the access address of the current access webpage after the parent frame jumps, wherein the access address carries the address of the current subframe in the open state;
when the fact that the current subframe in the parent frame of the current access page jumps is detected, the access address of the current access webpage is updated according to the address of the current subframe after the jump, and the access address comprises the address of the current subframe after the jump.
Of course, the storage medium provided by the embodiment of the present invention contains computer-executable instructions, and the computer-executable instructions are not limited to the method operations described above, and may also perform related operations in the method for determining a web page access address provided by any embodiment of the present invention.
From the above description of the embodiments, it is obvious for those skilled in the art that the present invention can be implemented by software and necessary general hardware, and certainly, can also be implemented by hardware, but the former is a better embodiment in many cases. Based on such understanding, the technical solutions of the present invention may be embodied in the form of a software product, which may be stored in a computer-readable storage medium, such as a floppy disk, a Read-Only Memory (ROM), a Random Access Memory (RAM), a FLASH Memory (FLASH), a hard disk or an optical disk of a computer, and includes several instructions to enable a computer device (which may be a personal computer, a server, or a network device) to execute the method for determining a web page Access address according to the embodiments of the present invention.
It should be noted that, in the embodiment of the apparatus for determining a web page access address, each unit and each module included in the embodiment are only divided according to functional logic, but are not limited to the above division as long as the corresponding function can be implemented; in addition, specific names of the functional units are only for convenience of distinguishing from each other, and are not used for limiting the protection scope of the present invention.
It is to be noted that the foregoing is only illustrative of the preferred embodiments of the present invention and the technical principles employed. It will be understood by those skilled in the art that the present invention is not limited to the particular embodiments described herein, but is capable of various obvious changes, rearrangements and substitutions as will now become apparent to those skilled in the art without departing from the scope of the invention. Therefore, although the present invention has been described in greater detail by the above embodiments, the present invention is not limited to the above embodiments, and may include other equivalent embodiments without departing from the spirit of the present invention, and the scope of the present invention is determined by the scope of the appended claims.