CN104133844A - Method and device for loading webpage - Google Patents

Method and device for loading webpage Download PDF

Info

Publication number
CN104133844A
CN104133844A CN201410302936.XA CN201410302936A CN104133844A CN 104133844 A CN104133844 A CN 104133844A CN 201410302936 A CN201410302936 A CN 201410302936A CN 104133844 A CN104133844 A CN 104133844A
Authority
CN
China
Prior art keywords
pattern
css
file
html
script
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.)
Pending
Application number
CN201410302936.XA
Other languages
Chinese (zh)
Inventor
江岱霖
潘俊
任远
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Beijing Xiaomi Technology Co Ltd
Xiaomi Inc
Original Assignee
Xiaomi Inc
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 Xiaomi Inc filed Critical Xiaomi Inc
Priority to CN201410302936.XA priority Critical patent/CN104133844A/en
Publication of CN104133844A publication Critical patent/CN104133844A/en
Pending legal-status Critical Current

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/90Details of database functions independent of the retrieved data types
    • G06F16/95Retrieval from the web
    • G06F16/957Browsing optimisation, e.g. caching or content distillation
    • G06F16/9574Browsing optimisation, e.g. caching or content distillation of access to content, e.g. by caching

Landscapes

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

Abstract

The invention relates to a method and a device for loading a webpage. The method comprises the following steps that: a predefined script style file is obtained; CSS (Cascading Style Sheets) styles are automatically generated according to the script style file; and HTML (Hyper Text Markup Language) elements in the located webpage are described through the CSS styles. Different styles can be compiled through adopting the script style file defined by few script language codes, so the generating efficiency of the CSS styles can be improved; the description complexity on the HTML elements during the webpage loading by a browser is correspondingly reduced; and the webpage loading speed is accelerated.

Description

The method of Web page loading and device
Technical field
The disclosure relates to technical field of the computer network, relates in particular to method and the device of Web page loading.
Background technology
Browser, by the file in display web page server or archives economy, comprises word, image, video image etc., realizes the interaction of user and these files.Above-mentioned file layout is generally HTML (Hyper Text Markup Language, HTML (Hypertext Markup Language)) file, the process of browser Web page loading, be actually the process that loads html file, html file is comprised of some nested html element elements, each html element element can be described by some (Cascading Style Sheets, Cascading Style Sheet) pattern.
In correlation technique, conventionally adopt CSS language compilation CSS pattern, CSS pattern can comprise font, color, spacing etc., to describe the different attribute of html element element by CSS pattern, but because CSS language is a kind of low-level language, it does not support the functions such as integrated, variable, condition judgment, therefore, when html element element is described by CSS pattern, may need a plurality of CSS patterns to combine, could be described certain html element element, and for different html element elements, make it have same alike result, also will write respectively CSS pattern.Therefore, in order to describe different html element elements, need to generate in advance a large amount of CSS patterns, these CSS patterns are all manually write by developer, cause the formation efficiency of CSS pattern not high, accordingly, the description process to html element element during browser Web page loading is loaded down with trivial details, makes webpage loading velocity slack-off.
Summary of the invention
The disclosure provides method and the device of Web page loading, and to solve, in correlation technique, to generate the efficiency of CSS pattern lower, causes html element sketch to state the problem that process is loaded down with trivial details.
According to the first aspect of disclosure embodiment, a kind of method of Web page loading is provided, comprising:
Obtain predefined script pattern file;
According to described script pattern file, automatically generate Cascading Style Sheet CSS pattern;
By described CSS pattern, the HTML (Hypertext Markup Language) html element element in institute's Web page loading is described.
Optionally, describedly according to described script pattern file, automatically generate CSS pattern and comprise:
Described script pattern file is carried out to native compile and generate some CSS patterns;
Described CSS pattern is saved in the list of CSS pattern.
Optionally, the described html element element of describing in institute's Web page loading by described CSS pattern comprises:
When the html file of Web page loading, obtain the style type of the html element element statement in described html file;
According to described style type, from the list of described CSS pattern, search target CS S pattern;
The target CS S pattern finding is applied on described html element element.
Optionally, describedly according to described script pattern file, automatically generate CSS pattern and comprise:
Described script pattern file is embedded in browser storehouse;
When the html file of Web page loading, obtain the style type of the html element element statement in described html file;
According to described style type, compile in real time the script pattern file generated target CS S pattern in described browser storehouse.
Optionally, the described html element element of describing in described webpage by described CSS pattern comprises:
The target CS S pattern that compiling is generated is applied on described html element element.
Optionally, described script pattern file comprises: the JS pattern file generating by JavaScript.
According to the second aspect of disclosure embodiment, a kind of device of Web page loading is provided, comprising:
Acquiring unit, for obtaining predefined script pattern file;
Generation unit, for automatically generating Cascading Style Sheet CSS pattern according to described script pattern file;
Loading unit, for describing the HTML (Hypertext Markup Language) html element element of institute's Web page loading by described CSS pattern.
Optionally, described generation unit comprises:
Native compile subelement, generates some CSS patterns for described script pattern file is carried out to native compile;
Pattern is preserved subelement, for described CSS pattern is saved in to the list of CSS pattern.
Optionally, described loading unit comprises:
The first kind is obtained subelement, for when the html file of Web page loading, obtains the style type of the html element element statement in described html file;
Pattern is searched subelement, for searching target CS S pattern according to described style type from the list of described CSS pattern;
The first pattern application subelement, for being applied to described html element element by the target CS S pattern finding.
Optionally, described generation unit comprises:
Pattern embeds subelement, for described script pattern file is embedded into browser storehouse;
Second Type obtains subelement, for when the html file of Web page loading, obtains the style type of the html element element statement in described html file;
Compiling subelement, for according to described style type, compiles the script pattern file generated target CS S pattern in described browser storehouse in real time in real time.
Optionally, described loading unit comprises:
The second pattern application subelement, is applied to described html element element for the target CS S pattern that compiling is generated.
Optionally, described script pattern file comprises: the JS pattern file generating by JavaScript.
According to the third aspect of disclosure embodiment, a kind of device of Web page loading is provided, comprising:
Processor;
Storer for storage of processor executable instruction;
Wherein, described processor is configured to:
Obtain predefined script pattern file;
According to described script pattern file, automatically generate Cascading Style Sheet CSS pattern;
By described CSS pattern, the HTML (Hypertext Markup Language) html element element in institute's Web page loading is described.
The technical scheme that embodiment of the present disclosure provides can comprise following beneficial effect:
CSS language generation CSS pattern is different from directly adopting in correlation technique, the pre-defined script pattern file of Premium Features that disclosure embodiment utilizes High level Script Language to have, and automatically generate CSS pattern according to these script pattern files, because script pattern file adopts High level Script Language definition, therefore can make full use of the succession of higher level lanquage, judgement, the functions such as variable declarations, therefore when describing different html element element, without generating in advance a large amount of CSS patterns, but by adopting the script pattern file of less script language code definition just can compile out different CSS patterns, therefore can improve the formation efficiency of CSS pattern, corresponding while having reduced browser Web page loading to the loaded down with trivial details degree of the description of html element element, improved webpage loading velocity.
Disclosure embodiment, based on predefined script pattern file, can first become some CSS patterns at native compile, so that browser when Web page loading, can directly call these CSS patterns, html element element is described, and further improves webpage loading velocity.
Disclosure embodiment is based on predefined script pattern file, browser also can be in webpage loading procedure, real-time compilation script pattern file, so that html element element is described, although there is the language-specific by CSS language is expanded in correlation technique, write CSS pattern, for example, less language, sass language etc., but adopt the CSS pattern of above-mentioned language definition directly to be moved by browser, and due to the operation of script pattern file being provided on browser, therefore the script pattern file of disclosure definition can be applied in the process of different browsers Web page loading, compile mode is flexible.
Script pattern file in disclosure embodiment can be the JS pattern file generating by JavaScript, JavaScript is a kind of explanatory script, it can directly be called by browser, and be widely used on html web page, therefore JS pattern file is convenient to definition, by the various CSS patterns of JS pattern file generated, can effectively improve the formation efficiency of CSS pattern.
Should be understood that, it is only exemplary and explanatory that above general description and details are hereinafter described, and can not limit the disclosure.
Accompanying drawing explanation
Accompanying drawing is herein merged in instructions and forms the part of this instructions, shows and meets embodiment of the present disclosure, and be used from and explain principle of the present disclosure with instructions one.
Fig. 1 is that the disclosure is according to the method flow diagram of a kind of Web page loading shown in an exemplary embodiment.
Fig. 2 is that the disclosure is according to the method flow diagram of the another kind of Web page loading shown in an exemplary embodiment.
Fig. 3 is that the disclosure is according to the method flow diagram of the another kind of Web page loading shown in an exemplary embodiment.
Fig. 4 is that the disclosure is according to the device block diagram of a kind of Web page loading shown in an exemplary embodiment.
Fig. 5 is that the disclosure is according to the device block diagram of the another kind of Web page loading shown in an exemplary embodiment.
Fig. 6 is that the disclosure is according to the device block diagram of the another kind of Web page loading shown in an exemplary embodiment.
Fig. 7 is that the disclosure is according to the device block diagram of the another kind of Web page loading shown in an exemplary embodiment.
Fig. 8 is that the disclosure is according to the device block diagram of the another kind of Web page loading shown in an exemplary embodiment.
Fig. 9 is that the disclosure is according to a structural representation of a kind of device for Web page loading shown in an exemplary embodiment.
Embodiment
Here will at length to exemplary embodiment, describe, its example shown in the accompanying drawings.When description below relates to accompanying drawing, unless separately there is expression, the same numbers in different accompanying drawings represents same or analogous key element.Embodiment described in following exemplary embodiment does not represent all embodiments consistent with the disclosure.On the contrary, they are only the examples with apparatus and method as consistent in some aspects that described in detail in appended claims, of the present disclosure.
The term using in the disclosure is only for the object of describing specific embodiment, but not is intended to limit the disclosure." a kind of " of the singulative using in disclosure and the accompanying claims book, " described " and " being somebody's turn to do " are also intended to comprise most forms, unless context clearly represents other implications.It is also understood that term "and/or" used herein refer to and comprise one or more projects of listing that are associated any or all may combine.
Although should be appreciated that in the disclosure and may adopt term first, second, third, etc. to describe various information, these information should not be limited to these terms.These terms are only used for the information of same type to be distinguished from each other out.For example, in the situation that not departing from disclosure scope, the first information also can be called as the second information, and similarly, the second information also can be called as the first information.Depend on linguistic context, as used in this word " if " can be construed as into " ... time " or " when ... time " or " in response to determine ".
The process of browser Web page loading, be actually the process that loads html file, html file is comprised of some nested html element elements, html element element can comprise web page title, webpage paragraph etc., and each html element element is described by some CSS patterns, and the description object of CSS pattern is html element element, CSS pattern comprises attribute and value, for example, color represents that attribute is " color ", and black represents that the property value of color is " black ".In Web page loading process, browser need to find the CSS pattern of html element element statement to be applied on this html element element, to make html element element present default effect.
CSS language is a kind of conventional pattern design language, in correlation technique, by CSS language compilation CSS pattern, because CSS language is a kind of low-level language, therefore adopt the efficiency of this language generation CSS pattern not high, disclosure embodiment can adopt High level Script Language, High level Script Language can be moved by direct explanation by browser, for example, High level Script Language can be JavaScript, JavaScript is a kind of based on object and event-driven and have the client script language of relative safety, the disclosure can define CSS pattern by JavaScript, thereby can effectively improve the formation efficiency of CSS pattern.
As shown in Figure 1, Fig. 1 is according to the method flow diagram of a kind of Web page loading shown in an exemplary embodiment, and the method can, in terminal browser, comprise the following steps:
In step 101, obtain predefined script pattern file.
Script pattern file in the present embodiment can be specially the JS pattern file generating by JavaScript.JavaScript is as a kind of OO higher level lanquage, can pre-define for generating the JS pattern file of CSS pattern file by it, due to JavaScript, there is the functions such as succession, condition judgment, variable declarations, therefore can generate JS pattern file, the formation efficiency of corresponding raising CSS pattern by less size of code.
In step 102, according to script pattern file, automatically generate Cascading Style Sheet CSS pattern.
The disclosure can, in advance at native compile CSS pattern, can comprise: script pattern file is carried out to native compile and generate some CSS patterns, CSS pattern is saved in the list of CSS pattern.
The disclosure also can compile CSS pattern in real time in browser Web page loading process, can comprise: script pattern file is embedded in browser storehouse, when the html file of Web page loading, obtain the style type of the html element element statement in html file, according to style type, compile in real time the script pattern file generated target CS S pattern in browser storehouse.
In step 103, by CSS pattern, the HTML (Hypertext Markup Language) html element element in institute's Web page loading is described.
If in step 102 at native compile CSS pattern, can be when the html file of Web page loading in this step, obtain the style type of the html element element statement in html file, according to style type, from the list of CSS pattern, search target CS S pattern, the target CS S pattern finding is applied on html element element.
If compile in real time CSS pattern in step 102 in browser Web page loading process, the target CS S pattern that compiling can be generated in this step be applied directly on described html element element.
As seen from the above-described embodiment, CSS language generation CSS pattern is different from directly adopting in correlation technique, the pre-defined script pattern file of Premium Features that disclosure embodiment utilizes High level Script Language to have, and automatically generate CSS pattern according to these script pattern files, because script pattern file adopts High level Script Language definition, therefore can make full use of the succession of higher level lanquage, judgement, the functions such as variable declarations, therefore when describing different html element element, without generating in advance a large amount of CSS patterns, but by adopting the script pattern file of less script language code definition just can compile out different CSS patterns, therefore can improve the formation efficiency of CSS pattern, corresponding while having reduced browser Web page loading to the loaded down with trivial details degree of the description of html element element, improved webpage loading velocity.
As shown in Figure 2, Fig. 2 is according to the method flow diagram of a kind of Web page loading shown in an exemplary embodiment, and the method can, in terminal browser, comprise the following steps:
In step 201, obtain predefined JS pattern file.
In the present embodiment, adopt JavaScript to pre-define for generating the JS pattern file of CSS pattern file, for example, style.js.Due to JavaScript, there is the functions such as succession, condition judgment, variable declarations, therefore can generate JS pattern file, the formation efficiency of corresponding raising CSS pattern by less size of code.
In first example, adopt the succession function meaning of word JS pattern file of JavaScript:
Can first define the JS pattern file of a parent:
In above-mentioned JS pattern file, the value that has defined the color attribute " color " of object is black " black ", and the value of text position attribute " text-align " is " center " placed in the middle.
Follow-up, the JS pattern file of definition subclass:
In above-mentioned JS pattern file, the value that has defined the width attribute " width " of object is 100 pixels " 100px ", and the value of height attributes " height " is 100 pixels " 100px ".
Utilize the succession function of JavaScript, make aforementioned subclass pattern can inherit the attribute of parent pattern:
// statement inheritance, ChildStyleSheet is a subclass of ParentStyleSheet
ChildStyleSheet.prototype=new?ParentStyleSheet();
The example of a subclass pattern of // generation
var?c=new?ChildStyleSheet();
In second example, adopt variable declarations and the arbitration functions definition JS pattern file of JavaScript:
var?backgroundColor="black";
In step 202, JS pattern file is carried out to native compile and generate some CSS patterns.
Although the direct operation of browser support to JS pattern file, the present embodiment, before browser Web page loading, can compile JS pattern file in this locality, can move style.js file, obtains some CSS pattern file style.css.
For first example in step 201, move the JS pattern file in this first example, can generate following CSS pattern file:
Apply the JS file in above-mentioned first example, according to inheritance, if the color attribute of some CSS patterns and text position attribute are all identical, and while only having width attribute different with height attributes, without re-defining identical attribute for each CSS pattern, but by a JS file of definition, utilize inheritance, generate above-mentioned CSS pattern.
For second example in step 201, move the JS pattern file in this second example, can generate following CSS pattern file:
Apply the JS file in above-mentioned second example, according to variable declarations and condition judgment function, if some CSS patterns all have background attribute and color attribute, but property value is not identical, apply the JS file in above-mentioned second example, the incidence relation between definition background attribute and color attribute, when generating concrete CSS pattern, for background attribute and color attribute are composed respectively upper different property value, thereby generate different CSS patterns.
In step 203, CSS pattern is saved in the list of CSS pattern.
In step 204, when the html file of Web page loading, obtain the style type of the html element element statement in html file.
In step 205, according to style type, from the list of CSS pattern, search target CS S pattern.
In step 206, the target CS S pattern finding is applied on html element element.
Browser is when Web page loading, conventionally resolve html file to rebuild DOM (Document Object Model, DOM Document Object Model) tree, by resolving html document, label in conversion dom tree is to DOM node, the corresponding html element element of each DOM node, when a new element joins in dom tree, browser can be looked through the list of CSS pattern by CSS engine, find meet this html element element CSS pattern corresponding to the style type of stating, and the CSS pattern finding is applied on this html element element.
As seen from the above-described embodiment, CSS language generation CSS pattern is different from directly adopting in correlation technique, the pre-defined script pattern file of Premium Features that the present embodiment utilizes High level Script Language to have, and automatically generate CSS pattern according to these script pattern files.Because script pattern file adopts High level Script Language definition, can make full use of the function such as succession, judgement, variable declarations of higher level lanquage, therefore when describing different html element element, without generating in advance a large amount of CSS patterns, but by adopting the script pattern file of less script language code definition just can compile out different CSS patterns, improve the formation efficiency of CSS pattern, corresponding while having reduced browser Web page loading to the loaded down with trivial details degree of the description of html element element, improved webpage loading velocity.The present embodiment, based on predefined script pattern file, can first become some CSS patterns at native compile, so that browser when Web page loading, can directly call these CSS patterns, html element element is described, and further improves webpage loading velocity.And, in the present embodiment, by JavaScript, generate JS pattern file, JavaScript is a kind of explanatory script, it can directly be called by browser, and be widely used on html web page, therefore JS pattern file is convenient to definition, by the various CSS patterns of JS pattern file generated, can effectively improve the formation efficiency of CSS pattern.
As shown in Figure 3, Fig. 3 is according to the process flow diagram of the method for a kind of Web page loading shown in an exemplary embodiment, and the method can, in terminal browser, comprise the following steps:
In step 301, obtain predefined JS pattern file.
In the present embodiment, adopt JavaScript to pre-define for generating the JS pattern file of CSS pattern file, for example, style.js.Due to JavaScript, there is the functions such as succession, condition judgment, variable declarations, therefore can generate JS pattern file, the formation efficiency of corresponding raising CSS pattern by less size of code.
In step 302, JS pattern file is embedded in browser storehouse.
The code resource that in browser storehouse, preservation can directly be moved by browser conventionally, in the present embodiment, can be directly embedded into the JS pattern file obtaining in step 301 in browser storehouse.
In step 303, when the html file of Web page loading, obtain the style type of the html element element statement in html file.
In step 304, according to style type, compile in real time the JS pattern file generated target CS S pattern in browser storehouse.
In step 305, the target CS S pattern that compiling is generated is applied on html element element.
JS pattern file based on having embedded in browser storehouse in the present embodiment, in the process of Web page loading, resolve html file to rebuild dom tree, by resolving html document, label in conversion dom tree is to DOM node, the corresponding html element element of each DOM node, when a new element joins in dom tree, browser can find meet this html element element JS pattern file corresponding to the style type of stating, compile this JS pattern file and can obtain corresponding CSS pattern, and this CSS pattern is applied on this html element element.
For example, supposing to have a html element element is a, when loading element a, the name that the style type of searching element a statement in browser storehouse obtains corresponding JS pattern file is called " sample-a ", and browser can be compiled into CSS pattern by JS pattern file " sample-a " so.Because element a may dynamically generate, and JS pattern file " sample-a " is except element a, may not have other html element elements to quote, so in the present embodiment without in this locality, JS pattern file being compiled into CSS pattern in advance, but when element a occurs, more in real time according to JS pattern file generated CSS pattern.
As seen from the above-described embodiment, CSS language generation CSS pattern is different from directly adopting in correlation technique, the pre-defined script pattern file of Premium Features that the present embodiment utilizes High level Script Language to have, and automatically generate CSS pattern according to these script pattern files, because script pattern file adopts High level Script Language definition, therefore can make full use of the succession of higher level lanquage, judgement, the functions such as variable declarations, therefore when describing different html element element, without generating in advance a large amount of CSS patterns, but by adopting the script pattern file of less script language code definition just can compile out different CSS patterns, therefore can improve the formation efficiency of CSS pattern, corresponding while having reduced browser Web page loading to the loaded down with trivial details degree of the description of html element element, improved webpage loading velocity, the present embodiment is based on predefined script pattern file, browser also can be in webpage loading procedure, real-time compilation script pattern file, so that html element element is described, although there is the language-specific by CSS language is expanded in correlation technique, write CSS pattern, for example, less language, sass language etc., but adopt the CSS pattern of above-mentioned language definition directly to be moved by browser, and due to the operation of script pattern file being provided on browser, therefore the script pattern file of disclosure definition can be applied in the process of different browsers Web page loading, compile mode is flexible, and, the present embodiment can be the JS pattern file generating by JavaScript, JavaScript is a kind of explanatory script, it can directly be called by browser, and be widely used on html web page, therefore JS pattern file is convenient to definition, by the various CSS patterns of JS pattern file generated, can effectively improve the formation efficiency of CSS pattern.
Corresponding with the embodiment of the method for aforementioned Web page loading, the disclosure also provides the device embodiment of Web page loading.
As shown in Figure 4, Fig. 4 be the disclosure according to the device block diagram of a kind of Web page loading shown in an exemplary embodiment, described device comprises: acquiring unit 41, generation unit 42 and loading unit 43.
Wherein, acquiring unit 41, is configured to obtain predefined script pattern file;
Generation unit 42, is configured to automatically generate Cascading Style Sheet CSS pattern according to described script pattern file;
Loading unit 43, is configured to describe the HTML (Hypertext Markup Language) html element element in institute's Web page loading by described CSS pattern.
As seen from the above-described embodiment, CSS language generation CSS pattern is different from directly adopting in correlation technique, the pre-defined script pattern file of Premium Features that the present embodiment utilizes High level Script Language to have, and automatically generate CSS pattern according to these script pattern files, because script pattern file adopts High level Script Language definition, therefore can make full use of the succession of higher level lanquage, judgement, the functions such as variable declarations, therefore when describing different html element element, without generating in advance a large amount of CSS patterns, but by adopting the script pattern file of less script language code definition just can compile out different CSS patterns, therefore can improve the formation efficiency of CSS pattern, corresponding while having reduced browser Web page loading to the loaded down with trivial details degree of the description of html element element, improved webpage loading velocity.
As shown in Figure 5, Fig. 5 is that the disclosure is according to the device block diagram of the another kind of Web page loading shown in an exemplary embodiment, this embodiment is on aforementioned basis embodiment illustrated in fig. 4, and described generation unit 42 can comprise: native compile subelement 421 and pattern are preserved subelement 422.
Wherein, native compile subelement 421, is configured to that described script pattern file is carried out to native compile and generates some CSS patterns;
Pattern is preserved subelement 422, is configured to described CSS pattern to be saved in the list of CSS pattern.
As shown in Figure 6, Fig. 6 is that the disclosure is according to the device block diagram of the another kind of Web page loading shown in an exemplary embodiment, this embodiment is on aforementioned basis embodiment illustrated in fig. 5, and described loading unit 43 can comprise: the first kind is obtained subelement 431, pattern is searched subelement 432 and the first pattern application subelement 433.
Wherein, the first kind is obtained subelement 431, is configured to when the html file of Web page loading, obtains the style type of the html element element statement in described html file;
Pattern is searched subelement 432, is configured to search from the list of described CSS pattern according to described style type target CS S pattern;
The first pattern application subelement 433, is configured to the target CS S pattern finding to be applied on described html element element.
In embodiment shown in above-mentioned Fig. 5 and Fig. 6, based on predefined script pattern file, can first at native compile, become some CSS patterns, so that browser is when Web page loading, can directly call these CSS patterns html element element is described, further improve webpage loading velocity.
As shown in Figure 7, Fig. 7 is that the disclosure is according to the device block diagram of the another kind of Web page loading shown in an exemplary embodiment, this embodiment is on aforementioned basis embodiment illustrated in fig. 4, and described generator 42 can comprise: pattern embeds subelement 423, Second Type obtains subelement 424 and compiles in real time subelement 425.
Wherein, pattern embeds subelement 423, is configured to described script pattern file to be embedded in browser storehouse;
Second Type obtains subelement 424, is configured to when the html file of Web page loading, obtains the style type of the html element element statement in described html file;
Compiling subelement 425, is configured to according to described style type in real time, compiles in real time the script pattern file generated target CS S pattern in described browser storehouse.
As shown in Figure 8, Fig. 8 be the disclosure according to the device block diagram of the another kind of Web page loading shown in an exemplary embodiment, this embodiment is on aforementioned basis embodiment illustrated in fig. 7, described generation unit 43 can comprise: the second pattern application subelement 434.
Wherein, the second pattern application subelement 434, the target CS S pattern that is configured to compiling to generate is applied on described html element element.
In embodiment shown in above-mentioned Fig. 7 and Fig. 8, based on predefined script pattern file, browser also can be in webpage loading procedure, real-time compilation script pattern file, so that html element element is described, although there is the language-specific by CSS language is expanded in correlation technique, write CSS pattern, for example, less language, sass language etc., but adopt the CSS pattern of above-mentioned language definition directly to be moved by browser, and due to the operation of script pattern file being provided on browser, therefore the script pattern file of disclosure definition can be applied in the process of different browsers Web page loading, compile mode is flexible.
Optionally, in the device embodiment shown in above-mentioned Fig. 4 to Fig. 9, the script pattern file that acquiring unit 41 obtains can comprise: the JS pattern file generating by JavaScript.JavaScript is a kind of explanatory script, it can directly be called by browser, and is widely used on html web page, so JS pattern file is convenient to definition, by the various CSS patterns of JS pattern file generated, can effectively improve the formation efficiency of CSS pattern.
In said apparatus, the implementation procedure of the function and efficacy of unit specifically refers to the implementation procedure of corresponding step in said method, does not repeat them here.
For device embodiment, because it corresponds essentially to embodiment of the method, so relevant part is referring to the part explanation of embodiment of the method.Device embodiment described above is only schematic, the wherein said unit as separating component explanation can or can not be also physically to separate, the parts that show as unit can be or can not be also physical locations, can be positioned at a place, or also can be distributed in a plurality of network element.Can select according to the actual needs some or all of module wherein to realize the object of disclosure scheme.Those of ordinary skills, in the situation that not paying creative work, are appreciated that and implement.
As shown in Figure 9, Fig. 9 is that the disclosure is according to another structural representation of a kind of device 900 for Web page loading shown in an exemplary embodiment.For example, device 900 can be the mobile phone with routing function, computing machine, digital broadcast terminal, information receiving and transmitting equipment, game console, flat-panel devices, Medical Devices, body-building equipment, personal digital assistant etc.
With reference to Fig. 9, device 900 can comprise following one or more assembly: processing components 902, storer 904, power supply module 906, multimedia groupware 908, audio-frequency assembly 910, the interface 912 of I/O (I/O), sensor module 914, and communications component 916.
The integrated operation of processing components 902 common control device 900, such as with demonstration, call, data communication, the operation that camera operation and record operation are associated.Processing components 902 can comprise that one or more processors 920 carry out instruction, to complete all or part of step of above-mentioned method.In addition, processing components 902 can comprise one or more modules, is convenient to mutual between processing components 902 and other assemblies.For example, processing components 902 can comprise multi-media module, to facilitate mutual between multimedia groupware 908 and processing components 902.
Storer 904 is configured to store various types of data to be supported in the operation of device 900.The example of these data comprises for any application program of operation on device 900 or the instruction of method, contact data, telephone book data, message, picture, video etc.Storer 904 can be realized by the volatibility of any type or non-volatile memory device or their combination, as static RAM (SRAM), Electrically Erasable Read Only Memory (EEPROM), Erasable Programmable Read Only Memory EPROM (EPROM), programmable read only memory (PROM), ROM (read-only memory) (ROM), magnetic store, flash memory, disk or CD.
Power supply module 906 provides electric power for installing 900 various assemblies.Power supply module 906 can comprise power-supply management system, one or more power supplys, and other and the assembly that generates, manages and distribute electric power to be associated for device 900.
Multimedia groupware 908 is included in the screen that an output interface is provided between described device 900 and user.In certain embodiments, screen can comprise liquid crystal display (LCD) and touch panel (TP).If screen comprises touch panel, screen may be implemented as touch-screen, to receive the input signal from user.Touch panel comprises that one or more touch sensors are with the gesture on sensing touch, slip and touch panel.Described touch sensor is the border of sensing touch or sliding action not only, but also detects duration and the pressure relevant to described touch or slide.In certain embodiments, multimedia groupware 908 comprises a front-facing camera and/or post-positioned pick-up head.When device 900 is in operator scheme, during as screening-mode or video mode, front-facing camera and/or post-positioned pick-up head can receive outside multi-medium data.Each front-facing camera and post-positioned pick-up head can be fixing optical lens systems or have focal length and optical zoom ability.
Audio-frequency assembly 910 is configured to output and/or input audio signal.For example, audio-frequency assembly 910 comprises a microphone (MIC), and when device 900 is in operator scheme, during as call model, logging mode and speech recognition mode, microphone is configured to receive external audio signal.The sound signal receiving can be further stored in storer 904 or be sent via communications component 916.In certain embodiments, audio-frequency assembly 910 also comprises a loudspeaker, for output audio signal.
I/O interface 912 is for providing interface between processing components 902 and peripheral interface module, and above-mentioned peripheral interface module can be keyboard, some striking wheel, button etc.These buttons can include but not limited to: home button, volume button, start button and locking press button.
Sensor module 914 comprises one or more sensors, is used to device 900 that the state estimation of various aspects is provided.For example, sensor module 914 can detect the opening/closing state of device 900, the relative positioning of assembly, for example described assembly is display and the keypad of device 900, the position of all right pick-up unit 900 of sensor module 914 or 900 1 assemblies of device changes, user is with device 900 existence that contact or do not have the temperature variation of device 900 orientation or acceleration/deceleration and device 900.Sensor module 914 can comprise proximity transducer, be configured to without any physical contact time detect near the existence of object.Sensor module 914 can also comprise optical sensor, as CMOS or ccd image sensor, for using in imaging applications.In certain embodiments, this sensor module 914 can also comprise acceleration transducer, gyro sensor, Magnetic Sensor, pressure transducer, microwave remote sensor or temperature sensor.
Communications component 916 is configured to be convenient to the communication of wired or wireless mode between device 900 and other equipment.Device 900 wireless networks that can access based on communication standard, as WiFi, 2G or 3G, or their combination.In one exemplary embodiment, communications component 916 receives broadcast singal or the broadcast related information from external broadcasting management system via broadcast channel.In one exemplary embodiment, described communications component 916 also comprises near-field communication (NFC) module, to promote junction service.For example, can be based on radio-frequency (RF) identification (RFID) technology in NFC module, Infrared Data Association (IrDA) technology, ultra broadband (UWB) technology, bluetooth (BT) technology and other technologies realize.
In the exemplary embodiment, device 900 can be realized by one or more application specific integrated circuit (ASIC), digital signal processor (DSP), digital signal processing appts (DSPD), programmable logic device (PLD) (PLD), field programmable gate array (FPGA), controller, microcontroller, microprocessor or other electronic components, for carrying out said method.
In the exemplary embodiment, also provide a kind of non-provisional computer-readable recording medium that comprises instruction, for example, comprised the storer 904 of instruction, above-mentioned instruction can have been carried out said method by the processor 920 of device 900.For example, described non-provisional computer-readable recording medium can be ROM, random access memory (RAM), CD-ROM, tape, floppy disk and optical data storage equipment etc.
A non-provisional computer-readable recording medium, when the instruction in described storage medium is carried out by the processor of terminal, makes terminal can carry out a kind of method of Web page loading, and described method comprises: obtain predefined script pattern file; According to described script pattern file, automatically generate Cascading Style Sheet CSS pattern; By described CSS pattern, the HTML (Hypertext Markup Language) html element element in institute's Web page loading is described.
Those skilled in the art, considering instructions and putting into practice after invention disclosed herein, will easily expect other embodiment of the present disclosure.The application is intended to contain any modification of the present disclosure, purposes or adaptations, and these modification, purposes or adaptations are followed general principle of the present disclosure and comprised undocumented common practise or the conventional techniques means in the art of the disclosure.Instructions and embodiment are only regarded as exemplary, and true scope of the present disclosure and spirit are pointed out by claim below.
Should be understood that, the disclosure is not limited to precision architecture described above and illustrated in the accompanying drawings, and can carry out various modifications and change not departing from its scope.The scope of the present disclosure is only limited by appended claim.

Claims (13)

1. a method for Web page loading, is characterized in that, comprising:
Obtain predefined script pattern file;
According to described script pattern file, automatically generate Cascading Style Sheet CSS pattern;
By described CSS pattern, the HTML (Hypertext Markup Language) html element element in institute's Web page loading is described.
2. method according to claim 1, is characterized in that, describedly according to described script pattern file, automatically generates CSS pattern and comprises:
Described script pattern file is carried out to native compile and generate some CSS patterns;
Described CSS pattern is saved in the list of CSS pattern.
3. method according to claim 2, is characterized in that, the described html element element of describing in institute's Web page loading by described CSS pattern comprises:
When the html file of Web page loading, obtain the style type of the html element element statement in described html file;
According to described style type, from the list of described CSS pattern, search target CS S pattern;
The target CS S pattern finding is applied on described html element element.
4. method according to claim 1, is characterized in that, describedly according to described script pattern file, automatically generates CSS pattern and comprises:
Described script pattern file is embedded in browser storehouse;
When the html file of Web page loading, obtain the style type of the html element element statement in described html file;
According to described style type, compile in real time the script pattern file generated target CS S pattern in described browser storehouse.
5. method according to claim 4, is characterized in that, the described html element element of describing in described webpage by described CSS pattern comprises:
The target CS S pattern that compiling is generated is applied on described html element element.
6. according to the method described in claim 1 to 5 any one, it is characterized in that, described script pattern file comprises: the JS pattern file generating by JavaScript.
7. a device for Web page loading, is characterized in that, comprising:
Acquiring unit, for obtaining predefined script pattern file;
Generation unit, for automatically generating Cascading Style Sheet CSS pattern according to described script pattern file;
Loading unit, for describing the HTML (Hypertext Markup Language) html element element of institute's Web page loading by described CSS pattern.
8. device according to claim 7, is characterized in that, described generation unit comprises:
Native compile subelement, generates some CSS patterns for described script pattern file is carried out to native compile;
Pattern is preserved subelement, for described CSS pattern is saved in to the list of CSS pattern.
9. device according to claim 8, is characterized in that, described loading unit comprises:
The first kind is obtained subelement, for when the html file of Web page loading, obtains the style type of the html element element statement in described html file;
Pattern is searched subelement, for searching target CS S pattern according to described style type from the list of described CSS pattern;
The first pattern application subelement, for being applied to described html element element by the target CS S pattern finding.
10. device according to claim 7, is characterized in that, described generation unit comprises:
Pattern embeds subelement, for described script pattern file is embedded into browser storehouse;
Second Type obtains subelement, for when the html file of Web page loading, obtains the style type of the html element element statement in described html file;
Compiling subelement, for according to described style type, compiles the script pattern file generated target CS S pattern in described browser storehouse in real time in real time.
11. devices according to claim 10, is characterized in that, described loading unit comprises:
The second pattern application subelement, is applied to described html element element for the target CS S pattern that compiling is generated.
12. according to the device described in claim 7 to 11 any one, it is characterized in that, described script pattern file comprises: the JS pattern file generating by JavaScript.
The device of 13. 1 kinds of Web page loadings, is characterized in that, comprising:
Processor;
Storer for storage of processor executable instruction;
Wherein, described processor is configured to:
Obtain predefined script pattern file;
According to described script pattern file, automatically generate Cascading Style Sheet CSS pattern;
By described CSS pattern, the HTML (Hypertext Markup Language) html element element in institute's Web page loading is described.
CN201410302936.XA 2014-06-27 2014-06-27 Method and device for loading webpage Pending CN104133844A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201410302936.XA CN104133844A (en) 2014-06-27 2014-06-27 Method and device for loading webpage

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201410302936.XA CN104133844A (en) 2014-06-27 2014-06-27 Method and device for loading webpage

Publications (1)

Publication Number Publication Date
CN104133844A true CN104133844A (en) 2014-11-05

Family

ID=51806522

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201410302936.XA Pending CN104133844A (en) 2014-06-27 2014-06-27 Method and device for loading webpage

Country Status (1)

Country Link
CN (1) CN104133844A (en)

Cited By (15)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN104462249A (en) * 2014-11-19 2015-03-25 北京奇虎科技有限公司 Webpage loading method and device
CN105677654A (en) * 2014-11-18 2016-06-15 广州市动景计算机科技有限公司 Advertisement filtering method and device
CN105989126A (en) * 2015-02-15 2016-10-05 阿里巴巴集团控股有限公司 Webpage displaying method and device
CN106293552A (en) * 2016-07-28 2017-01-04 上海爱数信息技术股份有限公司 A kind of anti-Method of printing of browser and system
CN106375188A (en) * 2016-08-30 2017-02-01 腾讯科技(深圳)有限公司 Method, device and system for displaying interactive expressions
CN106407279A (en) * 2016-08-26 2017-02-15 乐视控股(北京)有限公司 Processing method and device for webpage style setting
CN106598616A (en) * 2016-12-21 2017-04-26 福建中金在线信息科技有限公司 Packaging method and apparatus for Less library
CN107329747A (en) * 2017-06-20 2017-11-07 福建中金在线信息科技有限公司 A kind of method and device for generating multi-threaded pattern
CN109189388A (en) * 2018-08-15 2019-01-11 深圳市轱辘汽车维修技术有限公司 Page configuration method, server and computer-readable medium
CN109190069A (en) * 2018-08-01 2019-01-11 北京空中优宜信息技术有限公司 A kind of web page element modality management method, apparatus and electronic equipment
CN109445780A (en) * 2018-09-19 2019-03-08 平安科技(深圳)有限公司 A kind of pattern edit methods and equipment
CN110020316A (en) * 2017-12-22 2019-07-16 航天信息股份有限公司 A kind of display methods and device of list
CN110275713A (en) * 2019-07-02 2019-09-24 四川长虹电器股份有限公司 A kind of improved method of Java Virtual Machine rear end compiling
CN112231619A (en) * 2020-10-15 2021-01-15 北京三快在线科技有限公司 Conversion method, conversion device, electronic equipment and storage medium
CN114154092A (en) * 2021-11-18 2022-03-08 网易有道信息技术(江苏)有限公司 Method for translating web pages and related product

Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20030192026A1 (en) * 2000-12-22 2003-10-09 Attila Szepesvary Methods and apparatus for grammar-based recognition of user-interface objects in HTML applications
CN102662672A (en) * 2012-04-05 2012-09-12 广州市动景计算机科技有限公司 Method and device for conducting skin changing process to webpages as well as mobile terminal

Patent Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20030192026A1 (en) * 2000-12-22 2003-10-09 Attila Szepesvary Methods and apparatus for grammar-based recognition of user-interface objects in HTML applications
CN102662672A (en) * 2012-04-05 2012-09-12 广州市动景计算机科技有限公司 Method and device for conducting skin changing process to webpages as well as mobile terminal

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
赵春红 等: "LESS CSS框架简介", 《HTTP://WWW.IBM.COM/DEVELOPERWORKS/CN/WEB/1207_ZHAOCH_LESSCSS/#ICOMMENTS》 *

Cited By (19)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN105677654A (en) * 2014-11-18 2016-06-15 广州市动景计算机科技有限公司 Advertisement filtering method and device
CN105677654B (en) * 2014-11-18 2020-07-03 阿里巴巴(中国)有限公司 Advertisement filtering method and device
CN104462249A (en) * 2014-11-19 2015-03-25 北京奇虎科技有限公司 Webpage loading method and device
CN104462249B (en) * 2014-11-19 2019-02-12 北京奇虎科技有限公司 Webpage loading method and device
CN105989126A (en) * 2015-02-15 2016-10-05 阿里巴巴集团控股有限公司 Webpage displaying method and device
CN105989126B (en) * 2015-02-15 2019-10-01 阿里巴巴集团控股有限公司 A kind of Webpage display process and device
CN106293552A (en) * 2016-07-28 2017-01-04 上海爱数信息技术股份有限公司 A kind of anti-Method of printing of browser and system
CN106407279A (en) * 2016-08-26 2017-02-15 乐视控股(北京)有限公司 Processing method and device for webpage style setting
CN106375188A (en) * 2016-08-30 2017-02-01 腾讯科技(深圳)有限公司 Method, device and system for displaying interactive expressions
CN106375188B (en) * 2016-08-30 2020-11-17 腾讯科技(深圳)有限公司 Method, device and system for presenting interactive expressions
CN106598616A (en) * 2016-12-21 2017-04-26 福建中金在线信息科技有限公司 Packaging method and apparatus for Less library
CN107329747A (en) * 2017-06-20 2017-11-07 福建中金在线信息科技有限公司 A kind of method and device for generating multi-threaded pattern
CN110020316A (en) * 2017-12-22 2019-07-16 航天信息股份有限公司 A kind of display methods and device of list
CN109190069A (en) * 2018-08-01 2019-01-11 北京空中优宜信息技术有限公司 A kind of web page element modality management method, apparatus and electronic equipment
CN109189388A (en) * 2018-08-15 2019-01-11 深圳市轱辘汽车维修技术有限公司 Page configuration method, server and computer-readable medium
CN109445780A (en) * 2018-09-19 2019-03-08 平安科技(深圳)有限公司 A kind of pattern edit methods and equipment
CN110275713A (en) * 2019-07-02 2019-09-24 四川长虹电器股份有限公司 A kind of improved method of Java Virtual Machine rear end compiling
CN112231619A (en) * 2020-10-15 2021-01-15 北京三快在线科技有限公司 Conversion method, conversion device, electronic equipment and storage medium
CN114154092A (en) * 2021-11-18 2022-03-08 网易有道信息技术(江苏)有限公司 Method for translating web pages and related product

Similar Documents

Publication Publication Date Title
CN104133844A (en) Method and device for loading webpage
CN107153541B (en) Browsing interaction processing method and device
JP5956725B2 (en) Method, device, and computer program product for providing context-aware help content
CN103914523A (en) Page rollback controlling method and page rollback controlling device
CN109032606A (en) The process of compilation method, apparatus and terminal of native applications program
CN104303181B (en) The network browsing of camera guiding
CN108287918B (en) Music playing method and device based on application page, storage medium and electronic equipment
US20170161240A1 (en) Web page operation method and electronic device for supporting the same
TW201535157A (en) Voice input command
CN104246659A (en) Instantiable gesture objects
CN108287919B (en) Webpage application access method and device, storage medium and electronic equipment
RU2595524C2 (en) Device and method for processing content of web resource in browser
KR101855147B1 (en) An analysis method for user preference and device therefor
CN105378817A (en) Incorporating external dynamic content into a whiteboard
US20200258517A1 (en) Electronic device for providing graphic data based on voice and operating method thereof
US20130080891A1 (en) Recording events generated for performing a task through user equipment
CN110262904B (en) Data acquisition method and device
CN104111979A (en) Search recommendation method and device
CN104636170A (en) Application acquiring method and device and electronic device
CN104063424B (en) Web page picture shows method and demonstration device
CN105786944A (en) Method and device for automatically turning pages of browser
CN102937963A (en) Template and server content download using protocol handlers
CN104035977A (en) Webpage loading method and device
CN104182505A (en) Webpage rearrangement method and device
CN111813305A (en) Application program starting method and device

Legal Events

Date Code Title Description
C06 Publication
PB01 Publication
C10 Entry into substantive examination
SE01 Entry into force of request for substantive examination
RJ01 Rejection of invention patent application after publication

Application publication date: 20141105

RJ01 Rejection of invention patent application after publication