CN106790276A - A kind of browser-cross data interactive method and device based on browser protocol - Google Patents
A kind of browser-cross data interactive method and device based on browser protocol Download PDFInfo
- Publication number
- CN106790276A CN106790276A CN201710090347.3A CN201710090347A CN106790276A CN 106790276 A CN106790276 A CN 106790276A CN 201710090347 A CN201710090347 A CN 201710090347A CN 106790276 A CN106790276 A CN 106790276A
- Authority
- CN
- China
- Prior art keywords
- browser
- data
- cross
- javascript
- readjustment
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Granted
Links
Classifications
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04L—TRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
- H04L67/00—Network arrangements or protocols for supporting network services or applications
- H04L67/01—Protocols
- H04L67/02—Protocols based on web technology, e.g. hypertext transfer protocol [HTTP]
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04L—TRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
- H04L69/00—Network arrangements, protocols or services independent of the application payload and not provided for in the other groups of this subclass
- H04L69/08—Protocols for interworking; Protocol conversion
Landscapes
- Engineering & Computer Science (AREA)
- Computer Networks & Wireless Communication (AREA)
- Signal Processing (AREA)
- Computer Security & Cryptography (AREA)
- Stored Programmes (AREA)
- Computer And Data Communications (AREA)
Abstract
The present invention relates to a kind of browser-cross data interactive method and device based on browser protocol, the method includes:Step 1, the user terminal browser are performed using JavaScript modules according to browser protocol and call local application order;Step 2, local application create Webserver, carry out the interaction of this simulation;Step 3, the JavaScript script files for calling public server, dynamic addition JavaScript script files, carry out cross-domain data transmission;After the completion of step 4, data is activation, at Webserver ends, control sets call back function, and being further loaded into callback instruction carries out data readjustment;Data storage is carried out after the completion of step 5, readjustment, readjustment is deleted and is quoted, to variable assignments, directly realize that data are returned using the variable in readjustment.The present invention realizes the interaction of data browser-cross, improves development efficiency.
Description
Technical field
The present invention relates to a kind of browser-cross data interactive method and device based on browser protocol, belong to internet skill
Art field.
Background technology
URL Protocol agreements, also known as browser protocol, are a kind of general agreements of browser, are normally used for
Applications are called, such as:A sudden peal of thunder is downloaded, calls Ali Wang Wang or QQ to carry out customer service etc..Due to browser protocol only
Can be unidirectional disposable interaction, can only disposably call application program, and without return value, call the rear page cannot be with applications
Interact, so simply doing some simple applications all the time.
Control is the encapsulation to data and method, possesses the attribute and method of oneself, and attribute is the simple visit of control data
The person of asking, method is then some simple and visible functions of control.Due to the diversity of web applications, many applications are wanted and system
Interact, for example:Card sender will need scanning system environment etc. with USB communications, secure payment.On this partial function browser
It is that no authority goes to complete, it is necessary to use the mode of control.Current browser is the period let a hundred schools contend, and every kind of browser makes
Control exploitation is carried out with respective development language.Because Development of Web Browser and language schema are different, developer has to study respectively
The development language of browser is planted, and to be debugged respectively, greatly reduce development efficiency.Additionally, different browsers running environment
Difference, though kernel is identical to be also required to separately carry out packing installation, or even the requirement of partial view device is examined into plug-in unit shop
Core, greatly reduces efficiency for issuing.
The content of the invention
Control exploitation is carried out using different development language present invention aim at browser is solved, same control is clear in difference
Looking on device can not simultaneously use problem, there is provided a kind of browser-cross data interactive method and device based on browser protocol.
At this stage, browser instrument mainly includes Trident kernels, Gecko kernels, WebKit kernels, Presto kernels
Four type browsers, different user terminals are provided with identical or different browser instrument, and the present invention solves above-mentioned technology and asks
The technical scheme of topic is as follows:A kind of browser-cross data interactive method based on browser protocol, methods described includes:
Step 1, the user terminal browser are performed using JavaScript modules according to browser protocol and called locally
Application command;
Step 2, local application create Webserver, and this simulation is carried out by JavaScript and Webserver
Interaction;
Step 3, the JavaScript script files for calling public server, dynamic addition JavaScript script files,
Cross-domain data transmission is carried out further with the JavaScript modules in DOM, the size that single sends data is no more than 2KB;
Further ask to find header file using Get classes;A JavaScript object is created using Create sentences;
After the completion of step 4, data is activation, at Webserver ends, control sets JavaScript call back functions, further carries
Entering JavaScript callback instructions carries out data readjustment;Further include to prevent data from reentrying using not Reentrant function;
Data storage is quoted to readjustment in JavaScript, is deleted after the completion of step 5, readjustment, by JavaScript file
In variable assignments, directly in readjustment using the variable realize data return.
A kind of browser-cross data interaction device based on browser protocol, including:
Application invocation module, for calling local application;
Simulation interactive module, creates Webserver, and carry out this topotype by JavaScript for local application
Intend interaction;
Cross-domain data sending module, for carrying out cross-domain data transmission using the JavaScript modules in DOM;
Callback module, for being adjusted back to returned data.
Further, including data reentry disabled module, for preventing data from reentrying.
Further, including data take out module, for take out return data variable.
Further, cross-domain data sending module single sends the size of data no more than 2KB.
Further, the device at least includes Trident kernels, Gecko kernels, WebKit kernels, Presto core types
One kind in browser.
The beneficial effects of the invention are as follows:Different controls need not be developed for different browsers, can solve the problem that control across browsing
Device uses problem, realizes that data browser-cross is interacted, and improves development efficiency.
Brief description of the drawings
Fig. 1 is the browser-cross data interactive method schematic diagram based on browser protocol;
Fig. 2 illustrates for cross-domain data transmission partial code;
Fig. 3 is returned data readjustment partial code citing;
Fig. 4 is the browser-cross data interaction device structural representation based on browser protocol;
Fig. 5 is the maximum length list of common browser HTTP Get requests URL.
Specific embodiment
Principle of the invention and feature are described below in conjunction with accompanying drawing, example is served only for explaining the present invention, and
It is non-for limiting the scope of the present invention.
Embodiment 1:
Fig. 1 is the browser-cross data interactive method schematic diagram based on browser protocol, one in first embodiment of the invention
Planting can realize the control solution that browser-cross is used.
Specifically, a kind of browser-cross data interactive method based on browser protocol, including:
Step 1, the user terminal browser are performed using JavaScript modules according to browser protocol and called locally
Application command;
Step 2, local application create Webserver, and this simulation is carried out by JavaScript and Webserver
Interaction;
Step 3, the JavaScript script files for calling public server, dynamic addition JavaScript script files,
Cross-domain data transmission is carried out further with the JavaScript modules in DOM, the size that single sends data is no more than 2KB;
Further ask to find header file using Get classes;A JavaScript object is created using Create sentences;
After the completion of step 4, data is activation, at Webserver ends, control sets JavaScript call back functions, further carries
Entering JavaScript callback instructions carries out data readjustment;Further include to prevent data from reentrying using not Reentrant function;
Data storage is quoted to readjustment in JavaScript, is deleted after the completion of step 5, readjustment, by JavaScript file
In variable assignments, directly in readjustment using the variable realize data return.
The present invention uses such scheme, it is possible to achieve JavaScript carries out this simulation and interacts with Webserver, passes through
JavaScript modules in DOM, can realize the local and cross-domain transmission of data, further carry out data by call back function
Readjustment, Reentrant function does not prevent data from reentrying.
Embodiment 2:
As shown in Fig. 2 the code field that wherein cross-domain data transmission is related to is exemplified below:
" // find document head
Var head=document.getElementsByTagName (' head') [0];
One JS object of // generation
Var jscript=document.createElement (' script');
Jscript.type='text/javascript';
// send data
Jscript.src=" http://127.0.0.1:The data that "+jlink_port+ "/"+" sends ";
// insertion element (the necessary insertBefore of compatible IE6)
head.insertBefore(jscript,head.firstChild);”
Embodiment 3:
As shown in figure 3, wherein data readjustment is exemplified below with reentrant code is prevented:
Embodiment:4:
As shown in figure 4, corresponding with the above method, the present invention also provides a kind of browser-cross data based on browser protocol
Interactive device 1, including:
Application invocation module 101, for calling local application;
Simulation interactive module 102, creates Webserver, and carry out this by JavaScript for local application
Simulation is interacted;
Cross-domain data sending module 103, for carrying out cross-domain data transmission using the JavaScript modules in DOM;
Callback module 105, for being adjusted back to returned data.
Data reentry disabled module 104, for preventing data from reentrying.
Data take out module 106, for taking out the data variable for returning.
The device further at least includes that Trident kernels, Gecko kernels, WebKit kernels, Presto core types are clear
The one kind look in device.
Embodiment 5:
As shown in figure 5, the maximum length of common browser HTTP Get requests URL, wherein:
IE6.0:2083 characters of URL maximum lengths, cannot submit to more than after maximum length.
IE7.0:2083 characters of URL maximum lengths, still can submit to, but can only be transmitted through more than after maximum length
2083 characters.
Firefox 3.0.3:7764 characters of URL maximum lengths, cannot submit to more than after maximum length.
Opera 9.52:7648 characters of URL maximum lengths, cannot submit to more than after maximum length.
Google Chrome 2.0.168:7713 characters of URL maximum lengths, cannot submit to more than after maximum length.
Because the Get classes for using are asked, the data of submission are limited by URL length, when data delivery control is within 2K, tool
Data need to be controlled within the scope of that of browser URL maximum length values minimum used by market for body, so as to meet control
The data volume of data browser-cross interaction.
The foregoing is only presently preferred embodiments of the present invention, be not intended to limit the invention, it is all it is of the invention spirit and
Within principle, any modification, equivalent substitution and improvements made etc. should be included within the scope of the present invention.
Claims (10)
1. a kind of browser-cross data interactive method based on browser protocol, it is characterised in that different user terminals are provided with
Identical or different browser instrument, methods described includes:
Step 1, the user terminal browser are called locally applied according to browser protocol using the execution of JavaScript modules
Program command;
Step 2, local application create Webserver, and the friendship of this simulation is carried out by JavaScript and Webserver
Mutually;
Step 3, the JavaScript script files for calling public server, dynamic addition JavaScript script files, enter one
Step carries out cross-domain data transmission using the JavaScript modules in DOM;
After the completion of step 4, data is activation, at Webserver ends, control sets JavaScript call back functions, is further loaded into
JavaScript callback instructions carry out data readjustment;
Data storage is quoted to readjustment in JavaScript, is deleted after the completion of step 5, readjustment, by JavaScript file
Variable assignments, directly realizes that data are returned in readjustment using the variable.
2. a kind of browser-cross data interactive method based on browser protocol according to claim 1, it is characterised in that
The step 3 further includes to ask to find header file using Get classes;One JavaScript pairs is created using Create sentences
As.
3. a kind of browser-cross data interactive method based on browser protocol according to claim 1, it is characterised in that
Single sends the size of data no more than 2KB in the step 3.
4. a kind of browser-cross data interactive method based on browser protocol according to claim 1, it is characterised in that
The step 4 further includes to prevent data from reentrying using not Reentrant function.
5. a kind of browser-cross data interactive method based on browser protocol according to claim 1, it is characterised in that
The browser instrument is at least Trident kernels, Gecko kernels, WebKit kernels, the one of Presto core type browsers
Kind.
6. a kind of browser-cross data interaction device based on browser protocol, it is characterised in that including:
Application invocation module, for calling local application;
Simulation interactive module, creates Webserver, and carry out the friendship of this simulation by JavaScript for local application
Mutually;
Cross-domain data sending module, for carrying out cross-domain data transmission using the JavaScript modules in DOM;
Callback module, for being adjusted back to returned data.
7. a kind of browser-cross data interaction device based on browser protocol according to claim 6, it is characterised in that
Data reentry disabled module is further included, for preventing data from reentrying.
8. a kind of browser-cross data interaction device based on browser protocol according to claim 6, it is characterised in that
Further include that data take out module, for taking out the data variable for returning.
9. a kind of browser-cross data interaction device based on browser protocol according to claim 6, it is characterised in that
The size that the cross-domain data sending module single sends data is no more than 2KB.
10. a kind of browser-cross data interaction device based on browser protocol according to claim 6, its feature exists
In the device further at least includes Trident kernels, Gecko kernels, WebKit kernels, Presto core type browsers
In one kind.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201710090347.3A CN106790276B (en) | 2017-02-20 | 2017-02-20 | Cross-browser data interaction method and device based on browser protocol |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201710090347.3A CN106790276B (en) | 2017-02-20 | 2017-02-20 | Cross-browser data interaction method and device based on browser protocol |
Publications (2)
Publication Number | Publication Date |
---|---|
CN106790276A true CN106790276A (en) | 2017-05-31 |
CN106790276B CN106790276B (en) | 2020-05-19 |
Family
ID=58958277
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN201710090347.3A Active CN106790276B (en) | 2017-02-20 | 2017-02-20 | Cross-browser data interaction method and device based on browser protocol |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN106790276B (en) |
Cited By (6)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
WO2019153492A1 (en) * | 2018-02-07 | 2019-08-15 | 平安科技(深圳)有限公司 | Method for realizing web and native function interaction, and electronic apparatus and readable storage medium |
CN111200744A (en) * | 2018-11-19 | 2020-05-26 | Tcl集团股份有限公司 | Multimedia playing control method and device and intelligent equipment |
CN111638909A (en) * | 2020-05-20 | 2020-09-08 | 中国软件与技术服务股份有限公司 | Method and electronic device for cross-browser and cross-platform calling of scanning equipment |
CN112099868A (en) * | 2020-08-18 | 2020-12-18 | 北京思特奇信息技术股份有限公司 | Method and system for calling control across browsers |
CN112379938A (en) * | 2020-11-06 | 2021-02-19 | 福建亿榕信息技术有限公司 | Cross-browser safe local application calling method based on domestic operating system |
CN116820431A (en) * | 2023-08-30 | 2023-09-29 | 山东威尔数据股份有限公司 | Embedded application development and operation method with full function node. Js |
Citations (5)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN101075240A (en) * | 2006-08-25 | 2007-11-21 | 腾讯科技(深圳)有限公司 | Method and system for spanned acquiring data |
CN102129405A (en) * | 2010-01-13 | 2011-07-20 | 微软公司 | Cross-browser interactivity testing |
CN102156644A (en) * | 2011-05-20 | 2011-08-17 | 广州中道电子科技有限公司 | Cross-browser cross-operation system control device |
WO2014025544A1 (en) * | 2012-08-09 | 2014-02-13 | Sweetlabs, Inc | Systems and methods for alert management |
CN106202537A (en) * | 2016-07-26 | 2016-12-07 | 江苏神州信源系统工程有限公司 | A kind of realize the method that browser-cross front end is mutual with terminal local |
-
2017
- 2017-02-20 CN CN201710090347.3A patent/CN106790276B/en active Active
Patent Citations (5)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN101075240A (en) * | 2006-08-25 | 2007-11-21 | 腾讯科技(深圳)有限公司 | Method and system for spanned acquiring data |
CN102129405A (en) * | 2010-01-13 | 2011-07-20 | 微软公司 | Cross-browser interactivity testing |
CN102156644A (en) * | 2011-05-20 | 2011-08-17 | 广州中道电子科技有限公司 | Cross-browser cross-operation system control device |
WO2014025544A1 (en) * | 2012-08-09 | 2014-02-13 | Sweetlabs, Inc | Systems and methods for alert management |
CN106202537A (en) * | 2016-07-26 | 2016-12-07 | 江苏神州信源系统工程有限公司 | A kind of realize the method that browser-cross front end is mutual with terminal local |
Non-Patent Citations (2)
Title |
---|
小小小小小亮: "《javascript和jQuery中的AJAX技术详解》", 《脚本之家》 * |
陈腊梅,李为,程振林,张晓力: "《AJAX跨域访问的研究与应用》", 《计算机工程与设计》 * |
Cited By (8)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
WO2019153492A1 (en) * | 2018-02-07 | 2019-08-15 | 平安科技(深圳)有限公司 | Method for realizing web and native function interaction, and electronic apparatus and readable storage medium |
CN111200744A (en) * | 2018-11-19 | 2020-05-26 | Tcl集团股份有限公司 | Multimedia playing control method and device and intelligent equipment |
CN111200744B (en) * | 2018-11-19 | 2021-05-25 | Tcl科技集团股份有限公司 | Multimedia playing control method and device and intelligent equipment |
CN111638909A (en) * | 2020-05-20 | 2020-09-08 | 中国软件与技术服务股份有限公司 | Method and electronic device for cross-browser and cross-platform calling of scanning equipment |
CN112099868A (en) * | 2020-08-18 | 2020-12-18 | 北京思特奇信息技术股份有限公司 | Method and system for calling control across browsers |
CN112379938A (en) * | 2020-11-06 | 2021-02-19 | 福建亿榕信息技术有限公司 | Cross-browser safe local application calling method based on domestic operating system |
CN116820431A (en) * | 2023-08-30 | 2023-09-29 | 山东威尔数据股份有限公司 | Embedded application development and operation method with full function node. Js |
CN116820431B (en) * | 2023-08-30 | 2023-11-14 | 山东威尔数据股份有限公司 | Embedded application development and operation method with full function node. Js |
Also Published As
Publication number | Publication date |
---|---|
CN106790276B (en) | 2020-05-19 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
US11144711B2 (en) | Webpage rendering method, device, electronic apparatus and storage medium | |
CN106790276A (en) | A kind of browser-cross data interactive method and device based on browser protocol | |
US7865544B2 (en) | Method and system for providing XML-based asynchronous and interactive feeds for web applications | |
US7870482B2 (en) | Web browser extension for simplified utilization of web services | |
US8719421B2 (en) | Cross domain interaction of a web application | |
CN103365862B (en) | It is a kind of for generating the method and apparatus of picture corresponding with the page | |
CA2839006C (en) | Methods for making ajax web applications bookmarkable and crawlable and devices thereof | |
CN103873918B (en) | Image processing method, device and terminal | |
US20060248166A1 (en) | System and method for client side rendering of a web page | |
US10120847B2 (en) | Methods for transforming requests for web content and devices thereof | |
US20080235573A1 (en) | Content Markup Transformation | |
US8914774B1 (en) | System and method for tagging code to determine where the code runs | |
KR20100049669A (en) | Secure inter-module communication mechanism | |
US20110145299A1 (en) | Offline Gadgets IDE | |
CN113467775B (en) | Page generation method and device | |
CN110941950B (en) | Interface document generation method, device, server and storage medium | |
US9971636B2 (en) | Methods for implementing web services and devices thereof | |
CN108629032A (en) | A kind of page fast response method and device based on delay load | |
US8874654B2 (en) | System for processing requests to portlets | |
CN103716319B (en) | A kind of apparatus and method of web access optimization | |
CN109460227A (en) | A kind of development approach of Website front-end, device, equipment and medium | |
CN102314467A (en) | Method for realizing synchronous browsing of web pages | |
CN103885988B (en) | Export method and device, the content output system of content | |
CN103425473A (en) | Implementation method and system of open micro-blog | |
CN114115897A (en) | Method for dynamically generating project local executable file based on nodejs script |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
PB01 | Publication | ||
PB01 | Publication | ||
SE01 | Entry into force of request for substantive examination | ||
SE01 | Entry into force of request for substantive examination | ||
GR01 | Patent grant | ||
GR01 | Patent grant |