WO2023060427A1 - 浏览器数据跨域共享方法、设备、介质及计算机程序产品 - Google Patents

浏览器数据跨域共享方法、设备、介质及计算机程序产品 Download PDF

Info

Publication number
WO2023060427A1
WO2023060427A1 PCT/CN2021/123232 CN2021123232W WO2023060427A1 WO 2023060427 A1 WO2023060427 A1 WO 2023060427A1 CN 2021123232 W CN2021123232 W CN 2021123232W WO 2023060427 A1 WO2023060427 A1 WO 2023060427A1
Authority
WO
WIPO (PCT)
Prior art keywords
page
domain
data
cross
domain name
Prior art date
Application number
PCT/CN2021/123232
Other languages
English (en)
French (fr)
Inventor
苏争光
Original Assignee
深圳Tcl新技术有限公司
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 深圳Tcl新技术有限公司 filed Critical 深圳Tcl新技术有限公司
Priority to PCT/CN2021/123232 priority Critical patent/WO2023060427A1/zh
Publication of WO2023060427A1 publication Critical patent/WO2023060427A1/zh

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/46Multiprogramming arrangements
    • G06F9/54Interprogram communication

Definitions

  • the present application relates to the technical field of computer communication, and in particular to a browser data cross-domain sharing method, device, medium and computer program product.
  • the same-origin policy is the core and most basic security function of browsers.
  • the protocol, domain name and port must be the same.
  • the localStorage (local storage) attribute allows storing (key, value) key-value pair data in the browser.
  • the spec requires localStorage with the specified key field Cross-domain access, for example, in the ARIB STD-B62 standard, the key names starting with the keywords "_common0" to "_common255" are regarded as access to the broadcaster's public area, that is, the localstorage of these keys (key fields) It needs to be shared in pages of different domain names of different broadcasting companies, but the use of localStorage also follows the same-origin policy agreement, so that different websites cannot directly share the same localStorage, which leads to different browser website pages being unable to communicate with their domain outside the domain for communication sharing.
  • the main purpose of this application is to provide a browser data cross-domain sharing method, device, medium and computer program product, aiming to solve the problem in the prior art that different browser website pages cannot communicate and share with domains other than the domain to which they belong technical problem.
  • the present application provides a browser data cross-domain sharing method
  • the browser data cross-domain sharing method includes:
  • the present application also provides a browser data cross-domain sharing device, the browser data cross-domain sharing device is a virtual device, and the browser data cross-domain sharing device includes:
  • a loading module configured to dynamically load cross-domain communication scripts in the pages of the first domain name and the page of the second domain name;
  • a sending module configured to send the first local data corresponding to the first domain name page and the second local data corresponding to the second domain name page to an interactive cache page based on the cross-domain communication script;
  • a reading module configured to read the second local data of the interaction cache page cache through the first domain name page and read the interaction cache page cache through the second domain name page based on the cross-domain communication script The first local data for .
  • the present application also provides a browser data cross-domain sharing device, the browser data cross-domain sharing device is a physical device, and the browser data cross-domain sharing device includes: a memory, a processor, and a device stored on the memory
  • a browser data cross-domain sharing program, the browser data cross-domain sharing program is executed by the processor to implement the steps of the above browser data cross-domain sharing method.
  • the present application also provides a readable storage medium, on which a browser data cross-domain sharing program is stored, and the browser data cross-domain sharing program is executed by a processor to implement the browser data cross-domain sharing as described above method steps.
  • the present application also provides a computer program product, including a computer program, and when the computer program is executed by a processor, the steps of the above-mentioned browser data cross-domain sharing method are realized.
  • This application provides a browser data cross-domain sharing method, device, medium, and computer program product. Compared with the technical means used by different websites in the prior art that cannot directly share the same localStorage, this application first uses the first domain name
  • the cross-domain communication script is dynamically loaded in the page and the second domain name page, and based on the cross-domain communication script, the first local data corresponding to the first domain name page and the second local data corresponding to the second domain name page are sent To the interactive cache page, and then realized that according to the cross-domain communication script, the local data corresponding to the pages of different domain names are all cached in the third-party page, that is, the interactive cache page, so as to perform corresponding data reading according to the interactive cache page Take, further, based on the cross-domain communication script, read the second local data cached in the interactive cache page through the first domain name page and read the cached data in the interactive cache page through the second domain name page The first local data realizes that based on the cross-domain communication script and the interactive cache page, the first domain name
  • FIG. 1 is a schematic flow diagram of the first embodiment of the browser data cross-domain sharing method of the present application
  • FIG. 2 is a schematic flow diagram of the second embodiment of the browser data cross-domain sharing method of the present application
  • FIG. 3 is a schematic flow diagram of the third embodiment of the browser data cross-domain sharing method of the present application.
  • FIG. 4 is a schematic structural diagram of a browser data cross-domain sharing device in a hardware operating environment involved in the browser data cross-domain sharing method in the embodiment of the present application.
  • An embodiment of the present application provides a browser data cross-domain sharing method.
  • the browser data cross-domain sharing method includes:
  • Step S10 dynamically loading cross-domain communication scripts in the first domain name page and the second domain name page;
  • the first domain name page and the second domain name page are pages located in different browser websites, that is, the first domain name page and the second domain name page
  • the same localStorage cannot be directly shared, wherein the localStorage is used to permanently save the data of the entire website and can be used as local storage, therefore, direct access and information transmission cannot be performed between the first domain name page and the second domain name and other operations
  • the cross-domain communication script is a script that rewrites the native method corresponding to localStorage and injects a communication tag, wherein the native method includes methods such as a data saving method, a data reading method, and a data deletion method, and the communication tag Including iframe tags and other communication tags, etc.
  • Dynamically load cross-domain communication scripts in the first domain name page and the second domain name page specifically, first, load the first domain name page and load the second domain name page, and wait for the first domain name page and the second domain name page to After the page of the second domain name is loaded, dynamically load the cross-domain communication script.
  • Step S20 based on the cross-domain communication script, sending the first local data corresponding to the first domain name page and the second local data corresponding to the second domain name page to an interactive cache page;
  • the interactive cache page is a temporary cache page for caching data corresponding to the first domain name page and the v. Sohu second domain name page.
  • the cross-domain communication script Based on the cross-domain communication script, send the first local data corresponding to the first domain name page and the second local data corresponding to the second domain name page to the interactive cache page, specifically, in the cross-domain communication script Redefine the data processing method corresponding to localStorage in , and create a cross-domain channel, wherein the cross-domain channel is a channel that uses inter-page cross-domain communication technology to communicate according to the receiving address, based on the cross-domain channel pointed to receiving the address, loading the interactive cache page, and then sending data storage information to the interactive cache page respectively through the first domain name page and the second domain name page, when the interactive cache page monitors the data storage information , save the first local data sent by the first domain name page and the second local data sent by the second domain name page, for example, create a javascript script file, and redefine localStorage in localStorage in the javascript script file.
  • Step S30 based on the cross-domain communication script, read the second local data cached in the interactive cache page through the first domain name page and read the first local data cached in the interactive cache page through the second domain name page. local data.
  • the data reading information for reading the second local data is sent to the interactive cache page through the first domain name page, and then through the interactive cache page Listening to the data reading information of reading the second local data, feeding back the second local data to the first domain name page, further, when sending the read information to the interactive cache page through the second domain name page
  • the data reading information of the first local data is obtained, and then the first local data is fed back to the second domain name page through the interactive cache page.
  • This embodiment provides a method for cross-domain sharing of browser data.
  • the embodiment of the present application first uses the first domain name page and the second The cross-domain communication script is dynamically loaded in the domain name page, and based on the cross-domain communication script, the first local data corresponding to the first domain name page and the second local data corresponding to the second domain name page are sent to the interactive cache page , and further realize that according to the cross-domain communication script, the local data corresponding to different domain name pages are cached in the third-party page, that is, the interactive cache page, so as to read corresponding data according to the interactive cache page, and further , based on the cross-domain communication script, read the second local data cached in the interactive cache page through the first domain name page and read the first local data cached in the interactive cache page through the second domain name page , based on the cross-domain communication script and the interactive cache page, the first domain name page and the second domain name page can read their corresponding
  • the first local data corresponding to the first domain name page and The step of sending the second local data corresponding to the second domain name page to the interactive cache page includes:
  • Step A10 redefining the data processing method in the cross-domain communication script, and dynamically creating a cross-domain channel
  • the data processing method includes native methods corresponding to localStorage such as localStorage.setItem (data saving method), localStorage.getItem (data reading method) and localStorage.removeItem (data deletion method)
  • the redefining data processing method is a processing method of rewriting the native method corresponding to the localStorage to perform cross-domain communication with the interactive cache page.
  • the browser data cross-domain sharing method further includes:
  • Step A11 injecting a function calling the data processing method into the first domain name page and the second domain name page.
  • the function calling the data processing method is injected into the first domain name page and the second domain name page, specifically, by rewriting the first domain name page and the second domain name page
  • the function corresponding to the data processing method is called, so that after the cross-domain communication script is loaded, the data processing method can be called through the first domain name page and the second domain name page.
  • Step A20 loading the interactive cache page based on the receiving address pointed to by the cross-domain channel
  • the receiving address is a website address corresponding to the interactive cache page.
  • Load the interactive cache page based on the receiving address pointed to by the cross-domain channel specifically, execute and load the interactive cache page according to the receiving address.
  • Step A30 based on the data processing method, respectively send the first local data corresponding to the first domain name page and the second local data corresponding to the second domain name page to an interactive cache page.
  • the first local data is data of (key, value) key-value pairs stored locally on the first domain name page
  • the second local data is the data of the second domain name Data of (key, value) key-value pairs stored locally on the page, wherein the key represents a specified key field, and the value represents a value associated with the specified key field.
  • the data storage method calling the data storage method to send data storage information to the interactive cache page respectively through the first domain name page and the second domain name page, wherein the sending data storage information is the page
  • the data of the local cache (key, value) key-value pair is sent to the instruction information of the interactive cache page.
  • the listening event in the interactive cache page listens to the data storage information, according to the specified keyword
  • the segment stores the first local data sent by the page of the first domain name and the second local data sent by the page of the second domain name.
  • the data processing method includes a data saving method, and based on the data processing method, the first local data corresponding to the first domain name page and the second local data corresponding to the second domain name page are respectively sent to
  • the steps to interactively cache a page include:
  • Step A31 based on the data saving method, sending data saving information to the interactive cache page through the first domain name page and the second domain name page respectively;
  • data saving information is sent to the interactive cache page through the first domain name page and the second domain name page respectively, specifically, according to the data saving method, through
  • the first domain name page and the second domain name page call their corresponding data storage methods to send data storage information to the interactive cache page, for example, in the JavaScript script, rewrite the localStorage.setItem method in window.localStorage , sending the (key, value) key pair value corresponding to localStorage.setItem to the interactive cache page through the window.frames[0].postMessage function.
  • Step A32 when the interactive cache page monitors the data saving information, save the first local data sent by the first domain name page and the second local data sent by the second domain name page.
  • the interactive cache page when the interactive cache page monitors the data saving information, it saves the first local data sent by the first domain name page and the second local data sent by the second domain name page, specifically , monitor through the monitoring event in the interactive cache page, when the interactive cache page monitors the data storage information, save the value associated with the key field specified in the data storage information, that is, save The first local data sent by the first domain name page and the second local data sent by the second domain name page, for example, in the interactive cache page, through window.addEventListener('message', function (e) ⁇ ) event to monitor, when the data saving information is monitored, the corresponding function event is dynamically loaded to respond, and then the data is saved.
  • the embodiment of the present application provides a browser data cross-domain sharing method, that is, redefining the data processing method in the cross-domain communication script, and dynamically creating a cross-domain channel, and then based on the cross-domain channel pointed to receiving the address, loading the interactive cache page, and further, based on the data processing method, respectively sending the first local data corresponding to the first domain name page and the second local data corresponding to the second domain name page to the interactive
  • the cache page realizes loading the interactive cache page through the data processing method and the cross-domain channel, so that the corresponding data can be sent to the interactive cache through the first domain name page and the second domain name page
  • different websites cannot directly share the same localStorage, resulting in the inability of different browser pages to communicate and share with domains other than their domains.
  • the interaction cache page is read through the first domain name page based on the cross-domain communication script
  • the steps of caching the second local data and reading the first local data cached in the interactive cache page through the second domain name page include:
  • Step B10 according to the cross-domain communication script, send the first data reading information for reading the second local data to the interactive cache page through the first domain name page;
  • the first data read information is instruction information for reading data between the page and the interactive cache page, and the first data read information includes the information corresponding to the data to be read. Keywords (key) and information receiving address, etc.
  • the first data reading information for reading the second local data is sent to the interactive cache page through the first domain name page, specifically, through the corresponding cross-domain communication script
  • a data processing method using the data processing method to create a communication channel with the interactive cache page, and then send the first data reading information of the specified key field to the interactive cache page through the first domain name page , to return the value corresponding to the key field through the interactive cache page.
  • Step B20 according to the cross-domain communication script, send the second data reading information for reading the first local data to the interactive cache page through the second domain name page;
  • the second data reading information for reading the first local data is sent to the interactive cache page through the second domain name page, specifically, through the cross-domain
  • the data processing method corresponding to the communication script creates a channel for communicating with the interactive cache page through the data reading method, and then sends the second key field specified key field to the interactive cache page through the second domain name page. Data read information to obtain the value corresponding to the specified key key field.
  • Step B30 based on the first data read information and the second data read information, feed back the cached first local data and second local data to respective corresponding pages through the interactive cache page.
  • the cached first local data and second local data are fed back to their corresponding pages through the interactive cache page , specifically, when the first data read information is monitored through the interactive cache page, the data read function is invoked, and then the second local data is fed back to the first domain name page, and the interactive cache
  • the page monitors the second data reading information it feeds back the first local data to the second domain name page through the interactive cache page, for example, the window.addEventListener method in the interactive cache page monitors
  • the step of feeding back the cached first local data and second local data to their corresponding pages through the interactive cache page include:
  • Step B31 loading and monitoring events through the interactive cache page
  • Step B32 when the interactive cache page monitors the first data reading information, feed back the second local data to the first domain name page through the interactive cache page;
  • the second local data is fed back to the first domain name page through the interactive cache page, specifically, when the The interactive cache page listens to the first data read information, calls the data read function, and feeds back the data corresponding to the key field to the In the first domain name page.
  • Step B33 when the interactive cache page monitors the second data reading information, feed back the first local data to the second domain name page through the interactive cache page.
  • the first local data is fed back to the second domain name page through the interactive cache page, specifically,
  • the data reading function is called, and according to the key field corresponding to the second data reading information, the data corresponding to the key field is fed back to the page corresponding to the second data read information.
  • An embodiment of the present application provides a browser data cross-domain sharing method, that is, according to the cross-domain communication script, the first domain name page sends to the interactive cache page the command to read the second local data
  • the first data read information and according to the cross-domain communication script, send the second data read information for reading the first local data to the interactive cache page through the second domain name page, further, based on The first data read information and the second data read information feed back the cached first local data and second local data to their corresponding pages through the interactive cache page, realizing Communication information between a domain name page, the second domain name page and the interactive cache page, that is, the first data read information and the second data read information, so that the interactive cache page according to Corresponding data reading information, the data is fed back to the first domain name page and the second domain name page, so that the first domain name page and the second domain name page can mutually read their corresponding local data , in order to overcome the technology that in the prior art, because the use of localStorage also follows the same-origin policy agreement,
  • FIG. 4 is a schematic structural diagram of a browser data cross-domain sharing device in a hardware operating environment involved in the browser data cross-domain sharing method in the embodiment of the present application.
  • the browser data cross-domain sharing device may include: a processor 1001 , such as a CPU, a memory 1005 , and a communication bus 1002 .
  • the communication bus 1002 is used to realize connection and communication between the processor 1001 and the memory 1005 .
  • the memory 1005 can be a high-speed RAM memory, or a stable memory (non-volatile memory), such as disk storage.
  • the memory 1005 may also be a storage device independent of the aforementioned processor 1001 .
  • the browser data cross-domain sharing device may also include a rectangular user interface, a network interface, a camera, an RF (Radio Frequency, radio frequency) circuits, sensors, audio circuits, WiFi modules, etc.
  • the rectangular user interface may include a display screen (Display), an input sub-module such as a keyboard (Keyboard), and the optional rectangular user interface may also include a standard wired interface and a wireless interface.
  • the network interface may include a standard wired interface and a wireless interface (such as a WIFI interface).
  • the memory 1005 as a computer storage medium may include an operating system, a network communication module, and a browser data cross-domain sharing program.
  • the operating system is a program that manages and controls hardware and software resources of browser data cross-domain sharing devices, and supports the operation of browser data cross-domain sharing programs and other software and/or programs.
  • the network communication module is used to realize the communication among the various components inside the memory 1005, as well as communicate with other hardware and software in the browser data cross-domain sharing system.
  • the processor 1001 is configured to execute the browser data cross-domain sharing program stored in the memory 1005, so as to realize the browser data cross-domain sharing method described in any one of the above. step.
  • the present application also provides a browser data cross-domain sharing device, and the browser data cross-domain sharing device includes:
  • a loading module configured to dynamically load cross-domain communication scripts in the pages of the first domain name and the page of the second domain name;
  • a sending module configured to send the first local data corresponding to the first domain name page and the second local data corresponding to the second domain name page to an interactive cache page based on the cross-domain communication script;
  • a reading module configured to read the second local data of the interaction cache page cache through the first domain name page and read the interaction cache page cache through the second domain name page based on the cross-domain communication script The first local data for .
  • the sending module is also used for:
  • the first local data corresponding to the first domain name page and the second local data corresponding to the second domain name page are respectively sent to an interactive cache page.
  • the sending module is also used for:
  • the reading module is also used for:
  • the first data reading information for reading the second local data is sent to the interactive cache page through the first domain name page;
  • the cached first local data and second local data are fed back to respective corresponding pages through the interactive cache page.
  • the reading module is also used for:
  • the interactive cache page monitors the second data reading information
  • the first local data is fed back to the second domain name page through the interactive cache page.
  • the browser data cross-domain sharing device is also used for:
  • the specific implementation manner of the device for cross-domain sharing of browser data in the present application is basically the same as the embodiments of the method for cross-domain sharing of browser data, and will not be repeated here.
  • the embodiment of the present application provides a readable storage medium, and the readable storage medium stores one or more programs, and the one or more programs can also be executed by one or more processors to implement The steps of the browser data cross-domain sharing method described in any one of the above.
  • the specific implementation manner of the readable storage medium of the present application is basically the same as the above-mentioned embodiments of the browser data cross-domain sharing method, and will not be repeated here.
  • the embodiment of the present application provides a computer program product, and the computer program product includes one or more computer programs, and the one or more computer programs can also be executed by one or more processors to implement The steps of the browser data cross-domain sharing method described in any one of the above.

Landscapes

  • Engineering & Computer Science (AREA)
  • Software Systems (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)
  • Information Transfer Between Computers (AREA)

Abstract

本申请公开了一种浏览器数据跨域共享方法、设备、介质及计算机程序产品,所述浏览器数据跨域共享方法包括:在第一域名页面和第二域名页面中动态加载跨域通信脚本,基于所述跨域通信脚本,将所述第一域名页面对应的第一本地数据和所述第二域名页面对应的第二本地数据发送至交互缓存页面,基于所述跨域通信脚本,通过所述第一域名页面读取所述交互缓存页面缓存的第二本地数据和通过所述第二域名页面读取所述交互缓存页面缓存的第一本地数据。本申请解决不同浏览器网站页面无法与其所属域之外的域进行通信共享的技术问题。

Description

浏览器数据跨域共享方法、设备、介质及计算机程序产品 技术领域
本申请涉及计算机通信技术领域,尤其涉及一种浏览器数据跨域共享方法、设备、介质及计算机程序产品。
背景技术
随着计算机技术的发展,由于同源策略的约定,浏览器不能跨域访问服务器资源,同源策略是浏览器最核心也最基本的安全功能,当两个页面同源时,它们之间的协议、域名和端口都必须相同,localStorage (本地存储)属性允许在浏览器中存储( key,value )键值对的数据,在日本ISDB双向浏览器应用中spec要求对指定关键字段的localStorage进行跨域访问,例如,在ARIB STD-B62标准中规定以“_common0”到“_common255”关键字开头的键名视为对广播公司公共区域的访问,也即,这些key(关键字段)的localstorage要在不同的广播公司不同域名页面中进行共享,但是,localStorage的使用也遵循同源策略约定的,使得不同的网站是不能直接共用相同的localStorage,进而导致不同浏览器网站页面无法与其所属域之外的域进行通信共享。
技术解决方案
本申请的主要目的在于提供一种浏览器数据跨域共享方法、设备、介质及计算机程序产品,旨在解决现有技术中的不同浏览器网站页面无法与其所属域之外的域进行通信共享的技术问题。
为实现上述目的,本申请提供一种浏览器数据跨域共享方法,所述浏览器数据跨域共享方法包括:
在第一域名页面和第二域名页面中动态加载跨域通信脚本;
基于所述跨域通信脚本,将所述第一域名页面对应的第一本地数据和所述第二域名页面对应的第二本地数据发送至交互缓存页面;
基于所述跨域通信脚本,通过所述第一域名页面读取所述交互缓存页面缓存的第二本地数据和通过所述第二域名页面读取所述交互缓存页面缓存的第一本地数据。
本申请还提供一种浏览器数据跨域共享装置,所述浏览器数据跨域共享装置为虚拟装置,所述浏览器数据跨域共享装置包括:
加载模块,用于在第一域名页面和第二域名页面中动态加载跨域通信脚本;
发送模块,用于基于所述跨域通信脚本,将所述第一域名页面对应的第一本地数据和所述第二域名页面对应的第二本地数据发送至交互缓存页面;
读取模块,用于基于所述跨域通信脚本,通过所述第一域名页面读取所述交互缓存页面缓存的第二本地数据和通过所述第二域名页面读取所述交互缓存页面缓存的第一本地数据。
本申请还提供一种浏览器数据跨域共享设备,所述浏览器数据跨域共享设备为实体设备,所述浏览器数据跨域共享设备包括:存储器、处理器以及存储在所述存储器上的浏览器数据跨域共享程序,所述浏览器数据跨域共享程序被所述处理器执行实现如上述的浏览器数据跨域共享方法的步骤。
本申请还提供一种可读存储介质,所述可读存储介质上存储浏览器数据跨域共享程序,所述浏览器数据跨域共享程序被处理器执行实现如上述的浏览器数据跨域共享方法的步骤。
本申请还提供一种计算机程序产品,包括计算机程序,所述计算机程序被处理器执行时实现如上述的浏览器数据跨域共享方法的步骤。
本申请提供了一种浏览器数据跨域共享方法、设备、介质及计算机程序产品,相比于现有技术采用的不同的网站不能直接共用相同的localStorage的技术手段,本申请首先在第一域名页面和第二域名页面中动态加载跨域通信脚本,进而基于所述跨域通信脚本,将所述第一域名页面对应的第一本地数据和所述第二域名页面对应的第二本地数据发送至交互缓存页面,进而实现了根据跨域通信脚本,将不同域名页面对应的本地数据均缓存至第三方页面中,也即所述交互缓存页面,以根据所述交互缓存页面进行相应的数据读取,进一步地,基于所述跨域通信脚本,通过所述第一域名页面读取所述交互缓存页面缓存的第二本地数据和通过所述第二域名页面读取所述交互缓存页面缓存的第一本地数据,实现了基于所述跨域通信脚本以及所述交互缓存页面,所述第一域名页面和所述第二域名页面能够相互读取各自对应的本地数据,从而达到了跨域共享的目的,克服了现有技术中由于localStorage的使用也遵循同源策略约定的,使得不同的网站是不能直接共用相同的localStorage,进而导致不同浏览器页面无法与其所属域之外的域进行通信共享的技术缺陷,从而实现了在不同浏览器网站中页面与其所属域之外的域进行数据共享。
附图说明
图1为本申请浏览器数据跨域共享方法第一实施例的流程示意图;
图2为本申请浏览器数据跨域共享方法第二实施例的流程示意图;
图3为本申请浏览器数据跨域共享方法第三实施例的流程示意图;
图4为本申请实施例中浏览器数据跨域共享方法涉及的硬件运行环境的浏览器数据跨域共享设备结构示意图。
本发明目的的实现、功能特点及优点将结合实施例,参照附图做进一步说明。
本发明的实施方式
应当理解,此处所描述的具体实施例仅用以解释本申请,并不用于限定本申请。
本申请实施例提供一种浏览器数据跨域共享方法,在本申请浏览器数据跨域共享方法的第一实施例中,参照图1,所述浏览器数据跨域共享方法包括:
步骤S10,在第一域名页面和第二域名页面中动态加载跨域通信脚本;
在本实施例中,需要说明的是,所述第一域名页面和所述第二域名页面分别位于不同浏览器网站中的页面,也即,所述第一域名页面和所述第二域名页面不能直接共用相同的localStorage,其中,所述localStorage用于长久保存整个网站的数据,可用作本地存储,因此,所述第一域名页面和所述第二域名之间不能直接进行访问和信息传递等操作,所述跨域通信脚本为重写localStorage对应的原生方法和注入通信标签的脚本,其中,所述原生方法包括数据保存方法、数据读取方法和删除数据方法等方法,所述通信标签包括iframe标签和其他通信标签等。
在第一域名页面和第二域名页面中动态加载跨域通信脚本,具体地,首先,加载所述第一域名页面和加载所述第二域名页面,待所述第一域名页面和所述第二域名页面加载完成后,动态载入所述跨域通信脚本。
步骤S20,基于所述跨域通信脚本,将所述第一域名页面对应的第一本地数据和所述第二域名页面对应的第二本地数据发送至交互缓存页面;
在本实施例中,需要说明的是,所述交互缓存页面为缓存所述第一域名页面和诉搜狐第二域名页面各自对应的数据的临时缓存页面。
基于所述跨域通信脚本,将所述第一域名页面对应的第一本地数据和所述第二域名页面对应的第二本地数据发送至交互缓存页面,具体地,在所述跨域通信脚本中重定义localStorage对应的数据处理方法,并创建跨域通道,其中,所述跨域通道为利用页面间跨域通信技术以实现根据接收地址进行通信的通道,基于所述跨域通道所指向的接收地址,加载所述交互缓存页面,进而通过所述第一域名页面以及所述第二域名页面分别向所述交互缓存页面发送数据保存信息,当所述交互缓存页面监听到所述数据保存信息时,保存所述第一域名页面发送的第一本地数据和所述第二域名页面发送的第二本地数据,例如,创建一个javascript脚本文件,在所述javascript脚本文件中重定义localStorage中localStorage.setItem(保存数据方法)、localStorage.getItem(读取数据方法)和localStorage.removeItem(删除数据方法)等原生方法,并执行原生方法中保存数据信息对应的localStorage.setItem = function(key, value)方法,也即,将value值存储到key(关键字段)中,进而通过iframe标签中的window.postMessage(信息发送)方法将对应的消息发送到所述交互缓存页面,以保存指定的key(关键字段),从而实现不同浏览器页面间的跨域通信。
步骤S30,基于所述跨域通信脚本,通过所述第一域名页面读取所述交互缓存页面缓存的第二本地数据和通过所述第二域名页面读取所述交互缓存页面缓存的第一本地数据。
在本实施例中,基于所述跨域通信脚本,通过所述第一域名页面读取所述交互缓存页面缓存的第二本地数据和通过所述第二域名页面读取所述交互缓存页面缓存的第一本地数据,具体地,根据所述跨域通信脚本,通过所述第一域名页面向所述交互缓存页面发送读取第二本地数据的数据读取信息,进而通过所述交互缓存页面监听所述读取第二本地数据的数据读取信息,将所述第二本地数据反馈至所述第一域名页面,进一步地,当通过所述第二域名页面向所述交互缓存页面发送读取第一本地数据的数据读取信息,进而通过所述交互缓存页面将所述第一本地数据反馈至所述第二域名页面。
本实施例提供了一种浏览器数据跨域共享方法,相比于现有技术采用的不同的网站是不能直接共用相同的localStorage的技术手段,本申请实施例首先在第一域名页面和第二域名页面中动态加载跨域通信脚本,进而基于所述跨域通信脚本,将所述第一域名页面对应的第一本地数据和所述第二域名页面对应的第二本地数据发送至交互缓存页面,进而实现了根据跨域通信脚本,将不同域名页面对应的本地数据均缓存至第三方页面中,也即所述交互缓存页面,以根据所述交互缓存页面进行相应的数据读取,进一步地,基于所述跨域通信脚本,通过所述第一域名页面读取所述交互缓存页面缓存的第二本地数据和通过所述第二域名页面读取所述交互缓存页面缓存的第一本地数据,实现了基于所述跨域通信脚本以及所述交互缓存页面,所述第一域名页面和所述第二域名页面能够相互读取各自对应的本地数据,从而达到了跨域共享的目的,克服了现有技术中由于localStorage的使用也遵循同源策略约定的,使得不同的网站是不能直接共用相同的localStorage,进而导致不同浏览器页面无法与其所属域之外的域进行通信共享的技术缺陷,从而实现了在不同浏览器网站中页面与其所属域之外的域进行数据共享。
进一步地,参照图2,基于本申请中第一实施例,在本申请的另一实施例中,所述基于所述跨域通信脚本,将所述第一域名页面对应的第一本地数据和所述第二域名页面对应的第二本地数据发送至交互缓存页面的步骤包括:
步骤A10,在所述跨域通信脚本中重定义数据处理方法,并动态创建跨域通道;
在本实施例中,需要说明的是,所述数据处理方法包括localStorage.setItem(保存数据方法)、localStorage.getItem(读取数据方法)和localStorage.removeItem(删除数据方法)等localStorage对应的原生方法,所述重定义数据处理方法为对所述localStorage对应的原生方法进行重写实现以和所述交互缓存页面进行跨域通信的处理方式。
在所述跨域通信脚本中重定义数据处理方法,并动态创建跨域通道,具体地,在所述跨域通信脚本中重写数据处理方法,并利用iframe标签进行创建跨域通信,通过在所述第一域名页面和所述第二域名页面中调用复写所述数据处理方法的实现,以实现能够和所述交互缓存页面进行通信。
其中,在所述跨域通信脚本中重定义数据处理方法,并动态创建跨域通道的步骤之后,所述浏览器数据跨域共享方法还包括:
步骤A11,在所述第一域名页面和所述第二域名页面中注入调用所述数据处理方法的函数。
在本实施例中,在所述第一域名页面和所述第二域名页面中注入调用所述数据处理方法的函数,具体地,通过在所述第一域名页面和所述第二域名页面改写调用所述数据处理方法对应的函数,以在加载所述跨域通信脚本后,通过所述第一域名页面和所述第二域名页面能够调用所述数据处理方法。
步骤A20,基于所述跨域通道所指向的接收地址,加载所述交互缓存页面;
在本实施例中,需要说明的是,所述接收地址为所述交互缓存页面对应的网站地址。
基于所述跨域通道所指向的接收地址,加载所述交互缓存页面,具体地,根据所述接收地址,运行加载所述交互缓存页面。
步骤A30,基于所述数据处理方法,分别将所述第一域名页面对应的第一本地数据和所述第二域名页面对应的第二本地数据发送至交互缓存页面。
在本实施例中,需要说明的是,所述第一本地数据为所述第一域名页面本地存储的(key,value)键值对的数据,所述第二本地数据为所述第二域名页面本地存储的(key,value)键值对的数据,其中,所述key表示指定的关键字段,所述value表示所述指定的关键字段所关联的值。
基于所述数据处理方法,分别将所述第一域名页面对应的第一本地数据和所述第二域名页面对应的第二本地数据发送至交互缓存页面,具体地,根据所述数据处理方法中的数据保存方法,调用所述数据保存方法,以通过所述第一域名页面和所述第二域名页面分别向所述交互缓存页面发送数据保存信息,其中,所述发送数据保存信息为将页面本地缓存(key,value)键值对的数据发送至所述交互缓存页面的指令信息,进一步地,当所述交互缓存页面中的监听事件监听到所述数据保存信息时,根据指定的关键字段进行保存所述第一域名页面发送的第一本地数据和所述第二域名页面发送的第二本地数据。
其中,所述数据处理方法包括数据保存方法,所述基于所述数据处理方法,分别将所述第一域名页面对应的第一本地数据和所述第二域名页面对应的第二本地数据发送至交互缓存页面的步骤包括:
步骤A31,基于所述数据保存方法,通过所述第一域名页面以及所述第二域名页面分别向所述交互缓存页面发送数据保存信息;
在本实施例中,基于所述数据保存方法,通过所述第一域名页面以及所述第二域名页面分别向所述交互缓存页面发送数据保存信息,具体地,根据所述数据保存方法,通过所述第一域名页面和所述第二域名页面调用各自对应的数据保存方法分别向所述交互缓存页面发送数据保存信息,例如,在JavaScript脚本中,重写window.localStorage中的localStorage.setItem方法,将localStorage.setItem对应的(key,value)键对值通过window.frames[0].postMessage函数发送给所述交互缓存页面中。
步骤A32,当所述交互缓存页面监听到所述数据保存信息时,保存所述第一域名页面发送的第一本地数据和所述第二域名页面发送的第二本地数据。
在本实施例中,当所述交互缓存页面监听到所述数据保存信息时,保存所述第一域名页面发送的第一本地数据和所述第二域名页面发送的第二本地数据,具体地,通过所述交互缓存页面中的监听事件进行监听,当所述交互缓存页面监听到所述数据保存信息时,保存所述数据保存信息中指定的关键字段所关联的值,也即,保存所述第一域名页面发送的第一本地数据和所述第二域名页面发送的第二本地数据,例如,在所述交互缓存页面中,通过window.addEventListener('message', function (e) {})事件进行监听,当监听到数据保存信息时,动态加载相应的函数事件进行响应,进而进行数据保存。
本申请实施例提供了一种浏览器数据跨域共享方法,也即,在所述跨域通信脚本中重定义数据处理方法,并动态创建跨域通道,进而基于所述跨域通道所指向的接收地址,加载所述交互缓存页面,进一步地,基于所述数据处理方法,分别将所述第一域名页面对应的第一本地数据和所述第二域名页面对应的第二本地数据发送至交互缓存页面,实现了通过所述数据处理方法和所述跨域通道,加载所述交互缓存页面,使得通过所述第一域名页面和所述第二域名页面能够发送相应的数据至所述交互缓存页面中,为克服现有技术中由于localStorage的使用也遵循同源策略约定的,使得不同的网站是不能直接共用相同的localStorage,进而导致不同浏览器页面无法与其所属域之外的域进行通信共享的技术缺陷奠定了基础。
进一步地,参照图3,基于本申请中第一实施例,在本申请的另一实施例中,所述基于所述跨域通信脚本,通过所述第一域名页面读取所述交互缓存页面缓存的第二本地数据和通过所述第二域名页面读取所述交互缓存页面缓存的第一本地数据的步骤包括:
步骤B10,根据所述跨域通信脚本,通过所述第一域名页面向所述交互缓存页面发送读取所述第二本地数据的第一数据读取信息;
在本实施例中,需要说明的是,所述第一数据读取信息为页面与所述交互缓存页面进行读取数据的指令信息,所述第一数据读取信息包括需要读取数据对应的关键字(key)和信息接收地址等。
根据所述跨域通信脚本,通过所述第一域名页面向所述交互缓存页面发送读取所述第二本地数据的第一数据读取信息,具体地,通过所述跨域通信脚本对应的数据处理方法,通过所述数据处理方法创建与所述交互缓存页面进行通信的通道,进而通过所述第一域名页面向所述交互缓存页面中发送指定的关键字段的第一数据读取信息,以通过所述交互缓存页面返回所述关键字段对应的值例如,根据localStorage.getItem = function(key)函数,通过window.postMessage()方法向所述交互缓存页面发送读取第二本地数据的第一数据读取信息。
步骤B20,根据所述跨域通信脚本,通过所述第二域名页面向所述交互缓存页面发送读取第一本地数据的第二数据读取信息;
在本实施例中,根据所述跨域通信脚本,通过所述第二域名页面向所述交互缓存页面发送读取第一本地数据的第二数据读取信息,具体地,通过所述跨域通信脚本对应的数据处理方法,通过所述数据读取方法创建与所述交互缓存页面进行通信的通道,进而通过所述第二域名页面向所述交互缓存页面中发送指定关键字段的第二数据读取信息,以获取指定key关键字段所对应的值。
步骤B30,基于所述第一数据读取信息和所述第二数据读取信息,通过所述交互缓存页面将缓存的第一本地数据和第二本地数据反馈至各自对应的页面中。
在本实施例中,基于所述第一数据读取信息和所述第二数据读取信息,通过所述交互缓存页面将缓存的第一本地数据和第二本地数据反馈至各自对应的页面中,具体地,通过所述交互缓存页面监听到所述第一数据读取信息时,调用数据读取函数,进而向所述第二本地数据反馈至所述第一域名页面中,所述交互缓存页面监听到所述第二数据读取信息时,通过所述交互缓存页面将所述第一本地数据反馈至所述第二域名页面中,例如,所述交互缓存页面中的window.addEventListener方法监听到需要读取数据对应的信息时,调用所述交互缓存页面中的数据读取函数,获得指定key关键字段所对应的值,并响应反馈至所述数据读取信息对应的页面中,进而实现了不同浏览器网站页面与其所属域之外的域进行通信。
其中,所述基于所述第一数据读取信息和所述第二数据读取信息,通过所述交互缓存页面将缓存的第一本地数据和第二本地数据反馈至各自对应的页面中的步骤包括:
步骤B31,通过所述交互缓存页面加载监听事件;
步骤B32,当所述交互缓存页面监听到第一数据读取信息时,通过所述交互缓存页面将所述第二本地数据反馈至所述第一域名页面;
在本实施例中,当所述交互缓存页面监听到第一数据读取信息时,通过所述交互缓存页面将所述第二本地数据反馈至所述第一域名页面,具体地,当通过所述交互缓存页面监听到所述第以数据读取信息,调用数据读取函数,并根据所述第以数据读取信息对应的关键字段,将所述关键字段对应的数据反馈至所述第一域名页面中。
步骤B33,当所述交互缓存页面监听到所述第二数据读取信息时,通过所述交互缓存页面将所述第一本地数据反馈至所述第二域名页面中。
在本实施例中,当所述交互缓存页面监听到所述第二数据读取信息时,通过所述交互缓存页面将所述第一本地数据反馈至所述第二域名页面中,具体地,当通过所述交互缓存页面监听到所述第二数据读取信息,调用数据读取函数,并根据所述第二数据读取信息对应的关键字段,将所述关键字段对应的数据反馈至所述第二数据读取信息对应的页面中。
本申请实施例提供了一种浏览器数据跨域共享方法,也即,根据所述跨域通信脚本,通过所述第一域名页面向所述交互缓存页面发送读取所述第二本地数据的第一数据读取信息,进而根据所述跨域通信脚本,通过所述第二域名页面向所述交互缓存页面发送读取所述第一本地数据的第二数据读取信息,进一步地,基于所述第一数据读取信息和所述第二数据读取信息,通过所述交互缓存页面将缓存的第一本地数据和第二本地数据反馈至各自对应的页面中,实现了基于所述第一域名页面、所述第二域名页面分别与所述交互缓存页面之间的通信信息,也即所述第一数据读取信息和所述第二数据读取信息,使得所述交互缓存页面根据相应的数据读取信息,将数据反馈至所述第一域名页面和所述第二域名页面中,进而使得所述第一域名页面和所述第二域名页面能够相互读取各自对应的本地数据,为克服现有技术中由于localStorage的使用也遵循同源策略约定的,使得不同的网站是不能直接共用相同的localStorage,进而导致不同浏览器页面无法与其所属域之外的域进行通信共享的技术缺陷奠定了基础
参照图4,图4为本申请实施例中浏览器数据跨域共享方法涉及的硬件运行环境的浏览器数据跨域共享设备结构示意图。
如图4所示,该浏览器数据跨域共享设备可以包括:处理器1001,例如CPU,存储器1005,通信总线1002。其中,通信总线1002用于实现处理器1001和存储器1005之间的连接通信。存储器1005可以是高速RAM存储器,也可以是稳定的存储器(non-volatile memory),例如磁盘存储器。存储器1005可选的还可以是独立于前述处理器1001的存储设备。
可选地,该浏览器数据跨域共享设备还可以包括矩形用户接口、网络接口、相机、RF(Radio Frequency,射频)电路,传感器、音频电路、WiFi模块等等。矩形用户接口可以包括显示屏(Display)、输入子模块比如键盘(Keyboard),可选矩形用户接口还可以包括标准的有线接口、无线接口。网络接口可选的可包括标准的有线接口、无线接口(如WIFI接口)。
本领域技术人员可以理解,图4中示出的浏览器数据跨域共享设备结构并不构成对浏览器数据跨域共享设备的限定,可以包括比图示更多或更少的部件,或者组合某些部件,或者不同的部件布置。
如图4所示,作为一种计算机存储介质的存储器1005中可以包括操作系统、网络通信模块以及浏览器数据跨域共享程序。操作系统是管理和控制浏览器数据跨域共享设备硬件和软件资源的程序,支持浏览器数据跨域共享程序以及其它软件和/或,程序的运行。网络通信模块用于实现存储器1005内部各组件之间的通信,以及与浏览器数据跨域共享系统中其它硬件和软件之间通信。
在图4所示的浏览器数据跨域共享设备中,处理器1001用于执行存储器1005中存储的浏览器数据跨域共享程序,实现上述任一项所述的浏览器数据跨域共享方法的步骤。
本申请浏览器数据跨域共享设备具体实施方式与上述浏览器数据跨域共享方法各实施例基本相同,在此不再赘述。
本申请还提供一种浏览器数据跨域共享装置,所述浏览器数据跨域共享装置包括:
加载模块,用于在第一域名页面和第二域名页面中动态加载跨域通信脚本;
发送模块,用于基于所述跨域通信脚本,将所述第一域名页面对应的第一本地数据和所述第二域名页面对应的第二本地数据发送至交互缓存页面;
读取模块,用于基于所述跨域通信脚本,通过所述第一域名页面读取所述交互缓存页面缓存的第二本地数据和通过所述第二域名页面读取所述交互缓存页面缓存的第一本地数据。
可选地,所述发送模块还用于:
在所述跨域通信脚本中重定义数据处理方法,并动态创建跨域通道;
基于所述跨域通道所指向的接收地址,加载所述交互缓存页面;
基于所述数据处理方法,分别将所述第一域名页面对应的第一本地数据和所述第二域名页面对应的第二本地数据发送至交互缓存页面。
可选地,所述发送模块还用于:
基于所述数据保存方法,通过所述第一域名页面以及所述第二域名页面分别向所述交互缓存页面发送数据保存信息;
当所述交互缓存页面监听到所述数据保存信息时,保存所述第一域名页面发送的第一本地数据和所述第二域名页面发送的第二本地数据。
可选地,所述读取模块还用于:
根据所述跨域通信脚本,通过所述第一域名页面向所述交互缓存页面发送读取所述第二本地数据的第一数据读取信息;
根据所述跨域通信脚本,通过所述第二域名页面向所述交互缓存页面发送读取所述第一本地数据的第二数据读取信息;
基于所述第一数据读取信息和所述第二数据读取信息,通过所述交互缓存页面将缓存的第一本地数据和第二本地数据反馈至各自对应的页面中。
可选地,所述读取模块还用于:
通过所述交互缓存页面加载监听事件;
当所述交互缓存页面监听到第一数据读取信息时,通过所述交互缓存页面将所述第二本地数据反馈至所述第一域名页面;
当所述交互缓存页面监听到所述第二数据读取信息时,通过所述交互缓存页面将所述第一本地数据反馈至所述第二域名页面中。
可选地,所述浏览器数据跨域共享装置还用于:
在所述第一域名页面和所述第二域名页面中注入调用所述数据处理方法的函数。
本申请浏览器数据跨域共享装置的具体实施方式与上述浏览器数据跨域共享方法各实施例基本相同,在此不再赘述。
本申请实施例提供了一种可读存储介质,且所述可读存储介质存储有一个或者一个以上程序,所述一个或者一个以上程序还可被一个或者一个以上的处理器执行以用于实现上述任一项所述的浏览器数据跨域共享方法的步骤。
本申请可读存储介质具体实施方式与上述浏览器数据跨域共享方法各实施例基本相同,在此不再赘述。
本申请实施例提供了一种计算机程序产品,且所述计算机程序产品包括有一个或者一个以上计算机程序,所述一个或者一个以上计算机程序还可被一个或者一个以上的处理器执行以用于实现上述任一项所述的浏览器数据跨域共享方法的步骤。
本申请计算机程序产品具体实施方式与上述浏览器数据跨域共享方法各实施例基本相同,在此不再赘述。
以上仅为本申请的优选实施例,并非因此限制本申请的专利范围,凡是利用本申请说明书及附图内容所作的等效结构或等效流程变换,或直接或间接运用在其他相关的技术领域,均同理包括在本申请的专利处理范围内。

Claims (20)

  1. 一种浏览器数据跨域共享方法,其特征在于,所述浏览器数据跨域共享方法包括:
    在第一域名页面和第二域名页面中动态加载跨域通信脚本;
    基于所述跨域通信脚本,将所述第一域名页面对应的第一本地数据和所述第二域名页面对应的第二本地数据发送至交互缓存页面;
    基于所述跨域通信脚本,通过所述第一域名页面读取所述交互缓存页面缓存的第二本地数据和通过所述第二域名页面读取所述交互缓存页面缓存的第一本地数据。
  2. 如权利要求1所述浏览器数据跨域共享方法,其特征在于,所述基于所述跨域通信脚本,将所述第一域名页面对应的第一本地数据和所述第二域名页面对应的第二本地数据发送至交互缓存页面的步骤包括:
    在所述跨域通信脚本中重定义数据处理方法,并动态创建跨域通道;
    基于所述跨域通道所指向的接收地址,加载所述交互缓存页面;
    基于所述数据处理方法,分别将所述第一域名页面对应的第一本地数据和所述第二域名页面对应的第二本地数据发送至交互缓存页面。
  3. 如权利要求2所述浏览器数据跨域共享方法,其特征在于,所述数据处理方法包括数据保存方法,
    所述基于所述数据处理方法,分别将所述第一域名页面对应的第一本地数据和所述第二域名页面对应的第二本地数据发送至交互缓存页面的步骤包括:
    基于所述数据保存方法,通过所述第一域名页面以及所述第二域名页面分别向所述交互缓存页面发送数据保存信息;
    当所述交互缓存页面监听到所述数据保存信息时,保存所述第一域名页面发送的第一本地数据和所述第二域名页面发送的第二本地数据。
  4. 如权利要求1所述浏览器数据跨域共享方法,其特征在于,所述基于所述跨域通信脚本,通过所述第一域名页面读取所述交互缓存页面缓存的第二本地数据和通过所述第二域名页面读取所述交互缓存页面缓存的第一本地数据的步骤包括:
    根据所述跨域通信脚本,通过所述第一域名页面向所述交互缓存页面发送读取所述第二本地数据的第一数据读取信息;
    根据所述跨域通信脚本,通过所述第二域名页面向所述交互缓存页面发送读取所述第一本地数据的第二数据读取信息;
    基于所述第一数据读取信息和所述第二数据读取信息,通过所述交互缓存页面将缓存的第一本地数据和第二本地数据反馈至各自对应的页面中。
  5. 如权利要求4所述浏览器数据跨域共享方法,其特征在于,所述基于所述第一数据读取信息和所述第二数据读取信息,通过所述交互缓存页面将缓存的第一本地数据和第二本地数据反馈至各自对应的页面中的步骤包括:
    通过所述交互缓存页面加载监听事件;
    当所述交互缓存页面监听到第一数据读取信息时,通过所述交互缓存页面将所述第二本地数据反馈至所述第一域名页面;
    当所述交互缓存页面监听到所述第二数据读取信息时,通过所述交互缓存页面将所述第一本地数据反馈至所述第二域名页面中。
  6. 如权利要求2所述浏览器数据跨域共享方法,其特征在于,在所述跨域通信脚本中重定义数据处理方法,并动态创建跨域通道的步骤之后,所述浏览器数据跨域共享方法还包括:
    在所述第一域名页面和所述第二域名页面中注入调用所述数据处理方法的函数。
  7. 一种浏览器数据跨域共享装置,其特征在于,所述浏览器数据跨域共享装置包括:
    加载模块,用于在第一域名页面和第二域名页面中动态加载跨域通信脚本;
    发送模块,用于基于所述跨域通信脚本,将所述第一域名页面对应的第一本地数据和所述第二域名页面对应的第二本地数据发送至交互缓存页面;
    读取模块,用于基于所述跨域通信脚本,通过所述第一域名页面读取所述交互缓存页面缓存的第二本地数据和通过所述第二域名页面读取所述交互缓存页面缓存的第一本地数据。
  8. 一种浏览器数据跨域共享设备,其特征在于,所述浏览器数据跨域共享设备包括:存储器、处理器以及存储在存储器上的浏览器数据跨域共享程序,
    所述浏览器数据跨域共享程序被所述处理器执行实现如下步骤:
    在第一域名页面和第二域名页面中动态加载跨域通信脚本;
    基于所述跨域通信脚本,将所述第一域名页面对应的第一本地数据和所述第二域名页面对应的第二本地数据发送至交互缓存页面;
    基于所述跨域通信脚本,通过所述第一域名页面读取所述交互缓存页面缓存的第二本地数据和通过所述第二域名页面读取所述交互缓存页面缓存的第一本地数据。
  9. 如权利要求8所述浏览器数据跨域共享设备,其特征在于,所述浏览器数据跨域共享程序被所述处理器执行实现如下步骤:
    在所述跨域通信脚本中重定义数据处理方法,并动态创建跨域通道;
    基于所述跨域通道所指向的接收地址,加载所述交互缓存页面;
    基于所述数据处理方法,分别将所述第一域名页面对应的第一本地数据和所述第二域名页面对应的第二本地数据发送至交互缓存页面。
  10. 如权利要求8所述浏览器数据跨域共享设备,其特征在于,所述浏览器数据跨域共享程序被所述处理器执行实现如下步骤:
    基于所述数据保存方法,通过所述第一域名页面以及所述第二域名页面分别向所述交互缓存页面发送数据保存信息;
    当所述交互缓存页面监听到所述数据保存信息时,保存所述第一域名页面发送的第一本地数据和所述第二域名页面发送的第二本地数据。
  11. 如权利要求8所述浏览器数据跨域共享设备,其特征在于,所述浏览器数据跨域共享程序被所述处理器执行实现如下步骤:
    根据所述跨域通信脚本,通过所述第一域名页面向所述交互缓存页面发送读取所述第二本地数据的第一数据读取信息;
    根据所述跨域通信脚本,通过所述第二域名页面向所述交互缓存页面发送读取所述第一本地数据的第二数据读取信息;
    基于所述第一数据读取信息和所述第二数据读取信息,通过所述交互缓存页面将缓存的第一本地数据和第二本地数据反馈至各自对应的页面中。
  12. 如权利要求8所述浏览器数据跨域共享设备,其特征在于,所述浏览器数据跨域共享程序被所述处理器执行实现如下步骤:
    通过所述交互缓存页面加载监听事件;
    当所述交互缓存页面监听到第一数据读取信息时,通过所述交互缓存页面将所述第二本地数据反馈至所述第一域名页面;
    当所述交互缓存页面监听到所述第二数据读取信息时,通过所述交互缓存页面将所述第一本地数据反馈至所述第二域名页面中。
  13. 一种可读存储介质,其特征在于,所述可读存储介质上存储有浏览器数据跨域共享程序,所述浏览器数据跨域共享程序被处理器执行实现如下步骤:
    在第一域名页面和第二域名页面中动态加载跨域通信脚本;
    基于所述跨域通信脚本,将所述第一域名页面对应的第一本地数据和所述第二域名页面对应的第二本地数据发送至交互缓存页面;
    基于所述跨域通信脚本,通过所述第一域名页面读取所述交互缓存页面缓存的第二本地数据和通过所述第二域名页面读取所述交互缓存页面缓存的第一本地数据。
  14. 如权利要求13所述可读存储介质,其特征在于,所述浏览器数据跨域共享程序被处理器执行时还实现如下步骤:
    在所述跨域通信脚本中重定义数据处理方法,并动态创建跨域通道;
    基于所述跨域通道所指向的接收地址,加载所述交互缓存页面;
    基于所述数据处理方法,分别将所述第一域名页面对应的第一本地数据和所述第二域名页面对应的第二本地数据发送至交互缓存页面。
  15. 如权利要求13所述可读存储介质,其特征在于,所述浏览器数据跨域共享程序被处理器执行时还实现如下步骤:
    基于所述数据保存方法,通过所述第一域名页面以及所述第二域名页面分别向所述交互缓存页面发送数据保存信息;
    当所述交互缓存页面监听到所述数据保存信息时,保存所述第一域名页面发送的第一本地数据和所述第二域名页面发送的第二本地数据。
  16. 如权利要求13所述可读存储介质,其特征在于,所述浏览器数据跨域共享程序被处理器执行时还实现如下步骤:
    根据所述跨域通信脚本,通过所述第一域名页面向所述交互缓存页面发送读取所述第二本地数据的第一数据读取信息;
    根据所述跨域通信脚本,通过所述第二域名页面向所述交互缓存页面发送读取所述第一本地数据的第二数据读取信息;
    基于所述第一数据读取信息和所述第二数据读取信息,通过所述交互缓存页面将缓存的第一本地数据和第二本地数据反馈至各自对应的页面中。
  17. 一种计算机程序产品,包括计算机程序,其特征在于,所述计算机程序被处理器执行时实现如下步骤:
    在第一域名页面和第二域名页面中动态加载跨域通信脚本;
    基于所述跨域通信脚本,将所述第一域名页面对应的第一本地数据和所述第二域名页面对应的第二本地数据发送至交互缓存页面;
    基于所述跨域通信脚本,通过所述第一域名页面读取所述交互缓存页面缓存的第二本地数据和通过所述第二域名页面读取所述交互缓存页面缓存的第一本地数据。
  18. 如权利要求17所述计算机程序产品,其特征在于,所述计算机程序被处理器执行时还实现如下步骤:
    在所述跨域通信脚本中重定义数据处理方法,并动态创建跨域通道;
    基于所述跨域通道所指向的接收地址,加载所述交互缓存页面;
    基于所述数据处理方法,分别将所述第一域名页面对应的第一本地数据和所述第二域名页面对应的第二本地数据发送至交互缓存页面。
  19. 如权利要求17所述计算机程序产品,其特征在于,所述计算机程序被处理器执行时还实现如下步骤:
    基于所述数据保存方法,通过所述第一域名页面以及所述第二域名页面分别向所述交互缓存页面发送数据保存信息;
    当所述交互缓存页面监听到所述数据保存信息时,保存所述第一域名页面发送的第一本地数据和所述第二域名页面发送的第二本地数据。
  20. 如权利要求17所述计算机程序产品,其特征在于,所述计算机程序被处理器执行时还实现如下步骤:
    根据所述跨域通信脚本,通过所述第一域名页面向所述交互缓存页面发送读取所述第二本地数据的第一数据读取信息;
    根据所述跨域通信脚本,通过所述第二域名页面向所述交互缓存页面发送读取所述第一本地数据的第二数据读取信息;
    基于所述第一数据读取信息和所述第二数据读取信息,通过所述交互缓存页面将缓存的第一本地数据和第二本地数据反馈至各自对应的页面中。
PCT/CN2021/123232 2021-10-12 2021-10-12 浏览器数据跨域共享方法、设备、介质及计算机程序产品 WO2023060427A1 (zh)

Priority Applications (1)

Application Number Priority Date Filing Date Title
PCT/CN2021/123232 WO2023060427A1 (zh) 2021-10-12 2021-10-12 浏览器数据跨域共享方法、设备、介质及计算机程序产品

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
PCT/CN2021/123232 WO2023060427A1 (zh) 2021-10-12 2021-10-12 浏览器数据跨域共享方法、设备、介质及计算机程序产品

Publications (1)

Publication Number Publication Date
WO2023060427A1 true WO2023060427A1 (zh) 2023-04-20

Family

ID=85988115

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2021/123232 WO2023060427A1 (zh) 2021-10-12 2021-10-12 浏览器数据跨域共享方法、设备、介质及计算机程序产品

Country Status (1)

Country Link
WO (1) WO2023060427A1 (zh)

Citations (8)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20070299857A1 (en) * 2006-06-23 2007-12-27 Microsoft Corporation Cross Domain Communication
CN103246667A (zh) * 2012-02-08 2013-08-14 腾讯科技(深圳)有限公司 数据跨域传递的方法及装置
CN104504096A (zh) * 2014-12-26 2015-04-08 北京奇虎科技有限公司 一种跨网页的信息传输方法和网页浏览装置
CN108932238A (zh) * 2017-05-23 2018-12-04 北京金山云网络技术有限公司 一种跨域通信方法及装置
US20190068723A1 (en) * 2017-08-25 2019-02-28 Salesforce.Com, Inc. Secure cross-domain session storage
US10291722B1 (en) * 2015-04-30 2019-05-14 Glance Networks, Inc. Method and apparatus for implementing co-browsing between domains
CN112380027A (zh) * 2020-10-20 2021-02-19 福建天泉教育科技有限公司 一种实现移动端环境下不同网页间的通信方法与终端
CN113420201A (zh) * 2021-06-09 2021-09-21 湖南大学 一种用于浏览器rpa系统的跨域元素定位与树生成方法

Patent Citations (8)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20070299857A1 (en) * 2006-06-23 2007-12-27 Microsoft Corporation Cross Domain Communication
CN103246667A (zh) * 2012-02-08 2013-08-14 腾讯科技(深圳)有限公司 数据跨域传递的方法及装置
CN104504096A (zh) * 2014-12-26 2015-04-08 北京奇虎科技有限公司 一种跨网页的信息传输方法和网页浏览装置
US10291722B1 (en) * 2015-04-30 2019-05-14 Glance Networks, Inc. Method and apparatus for implementing co-browsing between domains
CN108932238A (zh) * 2017-05-23 2018-12-04 北京金山云网络技术有限公司 一种跨域通信方法及装置
US20190068723A1 (en) * 2017-08-25 2019-02-28 Salesforce.Com, Inc. Secure cross-domain session storage
CN112380027A (zh) * 2020-10-20 2021-02-19 福建天泉教育科技有限公司 一种实现移动端环境下不同网页间的通信方法与终端
CN113420201A (zh) * 2021-06-09 2021-09-21 湖南大学 一种用于浏览器rpa系统的跨域元素定位与树生成方法

Non-Patent Citations (2)

* Cited by examiner, † Cited by third party
Title
DU, GULIU: "JavaScript Cross-domain Sharing Local LocalStorage data", JIANSHU, pages 1 - 9, XP009545482, Retrieved from the Internet <URL:https://www.jianshu.com/p/bd4145e789ec> *
SAMPLE_BRIEF BOOK: "Localstorage-Resolving Cross-domain Storage", JIANSHU, pages 1 - 6, XP009545483, Retrieved from the Internet <URL:https://www.jianshu.com/p/8f210531a857> *

Similar Documents

Publication Publication Date Title
US10798127B2 (en) Enhanced document and event mirroring for accessing internet content
US10237365B2 (en) Method and apparatus for automatically optimizing the loading of images in a cloud-based proxy service
US8458727B2 (en) Asynchronous client to server updates
US7698256B1 (en) History support for stateless Javascript Web client
WO2020181810A1 (zh) 应用于集群内多级缓存的数据处理方法和装置
US20080077851A1 (en) Method and apparatus for inserting jsr 168 portlet content into a j2ee java server page
CN109902255B (zh) 页面混合浏览记录生成方法、装置、设备和存储介质
WO2020034951A1 (zh) 利用前端编程语言优化图片懒加载的方法以及电子设备
CN112199442B (zh) 分布式批量下载文件方法、装置、计算机设备及存储介质
US20170221109A1 (en) Ads management in a browser application
WO2023231665A1 (zh) 分布式事务处理方法、系统、设备及可读存储介质
CN111125595B (zh) 多页面控制方法、装置、电子设备及存储介质
CN113784049A (zh) 安卓系统虚拟机的摄像头调用方法、电子设备和存储介质
US11477158B2 (en) Method and apparatus for advertisement anti-blocking
CN117390326A (zh) 页面管理方法、装置、设备以及存储介质
WO2023060427A1 (zh) 浏览器数据跨域共享方法、设备、介质及计算机程序产品
US11909831B2 (en) Multi-session cookie swap
CN113742623A (zh) 页面加载方法、组件、系统、装置及计算机可读存储介质
CN109445966B (zh) 事件处理方法、装置、介质和计算设备
CN107580253A (zh) 一种报错页面处理方法和装置
CN114490266A (zh) 一种数据采集方法、装置、设备及存储介质
CN114490265A (zh) 一种数据采集方法、装置、设备及存储介质
US11409796B1 (en) Generational databases for managing time series data
US10635731B2 (en) System for generating and executing editable multiple-step requests
JP6806351B1 (ja) 情報処理方法、コンピュータプログラム及び情報処理装置

Legal Events

Date Code Title Description
121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 21960177

Country of ref document: EP

Kind code of ref document: A1

NENP Non-entry into the national phase

Ref country code: DE