【Content of the invention】
The invention provides a kind of display packing of browser page and system, it is possible to increase the exploitation effect of browser page
Rate, reduces development cost.
The concrete technical scheme of the present invention is as follows:
According to one preferred embodiment of the present invention, a kind of display packing of browser page, including:
Default page code file is parsed and is rendered, obtained the page showing;The described page comprises page 1
Head, the first footer and document, described document includes the second top margin, content and the second footer, described first top margin and the first footer
Attribute be to be not take up document, the attribute of described second top margin and the second footer is to take document.
In said method, described default page code file is parsed and is rendered before, the method also includes:
Replicate the first top margin code in page code file and the first footer code, obtain the second top margin code and second
The page code file of footer code;
In wherein said first top margin code and the first footer code, the positioning properties of the first top margin and the first footer are solid
Fixed, in the second top margin code and the second footer code, the positioning properties of the second top margin and the second footer are set to static state, institute
Stating positioning properties is the second static top margin and the second footer occupancy document.
In said method, the described top margin code replicating in page code file and footer code are:
Receive user replicates respectively to the first top margin code in parent page code file and the first footer code
The the second top margin code obtaining afterwards and the second footer code.
In said method, the described top margin code replicating in page code file and footer code are:
Compiler finds described page code file according to the path of input, comprises to have and answer in described page code file
First top margin code of identifier processed and the first footer code, when being compiled to described page code file, according to described
Duplication identifier carries out duplication to described first top margin code and the first footer code and obtains the second top margin code and the second footer
Code.
In said method, the method also includes:
In the second top margin code and the second footer code, by the display characteristic attribute setting of the second top margin and the second footer
It is hiding;Wherein, described display characteristic attribute is the second hiding top margin and the second footer does not appear in browser forms.
In said method, described default page code file is resolved to:
Described page code file is parsed, obtains showing object, replicate the first top margin object in display object
With the first footer object, obtain the second top margin object and the second footer object;
In the CSS of wherein said first top margin object and the first footer object, the positioning of the first top margin and the first footer
Attribute is to fix, in the CSS of the second top margin object and the second footer object, by the positioning of the second top margin and the second footer
Attribute is set to static state, and wherein, described positioning properties are the second static top margin and the second footer takies document.
In said method, described the first top margin object replicating in display object and the first footer object are:
According to the display object of instruction in the order receiving and described order, to the first top margin object and the first footer object
Replicated;
The dom tree of described display object composition creates new branch, described new branch and the first top margin object and
The branch of the first footer object is at the same level;
The the second top margin object obtaining and the second footer object leaf node as new branch will be replicated.
In said method, the method also includes:
In the CSS of described second top margin object and the second footer object, by the display of the second top margin and the second footer
Property attribute is set to hide;Wherein, described display characteristic attribute be the second hiding top margin and the second footer do not appear in clear
Look in device forms.
The present invention also provides a kind of display system of browser page, including browser;It is single that described browser includes parsing
Unit and rendering unit;Wherein,
Resolution unit, for parsing to default page code file;
Rendering unit, renders for the page code file after resolution unit is parsed, and obtains the page showing;Institute
State the page and comprise the first top margin, the first footer and document, described document includes the second top margin, content and the second footer, described
The attribute of one top margin and the first footer is to be not take up document, and the attribute of described second top margin and the second footer is to take document.
In said system, this system also includes:
Copied cells, for replicating the first top margin code in page code file and the first footer code, obtains second
Top margin code and the page code file of the second footer code;In wherein said first top margin code and the first footer code, the
The positioning properties of one top margin and the first footer are to fix, in the second top margin code and the second footer code, by the second top margin and
The positioning properties of the second footer are set to static state, and described positioning properties are the second static top margin and the second footer takies document.
In said system, when described copied cells is located at browser, page in replicating page code file for the copied cells
When head code and footer code, specially:
Receive user replicates respectively to the first top margin code in parent page code file and the first footer code
The the second top margin code obtaining afterwards and the second footer code.
In said system, when described copied cells is located at compiler, described copied cells is in replicating page code file
Top margin code and during footer code, specially:
Described page code file is found according to the path of input, in described page code file, comprises that there is duplication mark
First top margin code of symbol and the first footer code, when being compiled to described page code file, replicate mark according to described
Knowledge symbol carries out duplication to described first top margin code and the first footer code and obtains the second top margin code and the second footer code.
In said system, described copied cells, it is additionally operable in the second top margin code and the second footer code, by page 2
The display characteristic attribute of head and the second footer is set to hide;Wherein, described display characteristic attribute be the second hiding top margin and
Second footer does not appear in browser forms.
In said system, described resolution unit further includes:Parsing subelement and duplication subelement;Wherein,
Described parsing subelement, for parsing to described page code file, obtains showing object;
Described duplication subelement, for replicating the first top margin object and the first footer object in display object, obtains the
Two top margin objects and the second footer object;In the CSS of wherein said first top margin object and the first footer object, page 1
The positioning properties of head and the first footer are to fix;It is additionally operable in the CSS of the second top margin object and the second footer object, will
The positioning properties of the second top margin and the second footer are set to static state, and wherein, described positioning properties are the second static top margin and the
Two footers take document.
In said system, the described subelement that replicates is replicating the first top margin object and the first footer object showing in object
When, specially:
According to the display object of instruction in the order receiving and described order, to the first top margin object and the first footer object
Replicated;
The dom tree of described display object composition creates new branch, described new branch and the first top margin object and
The branch of the first footer object is at the same level;
The the second top margin object obtaining and the second footer object leaf node as new branch will be replicated.
In said system, described duplication subelement, it is additionally operable to the sample in described second top margin object and the second footer object
In formula table, the display characteristic attribute of the second top margin and the second footer is set to hide;Wherein, described display characteristic attribute is hidden
The second top margin hidden and the second footer do not appear in browser forms.
As can be seen from the above technical solutions, what the present invention provided has the advantages that:
Original top margin and footer are used for showing, duplicated top margin and footer are as void as real top margin and footer
The top margin intended and footer occupy-place in a document, on the premise of not knowing top margin height and footer height in advance, can either avoid
Original top margin and footer cover the content of document, can ensure that there is top margin and footer in the page of display again simultaneously, fall
The development cost of the low page and maintenance cost, improve development efficiency.
【Specific embodiment】
In order that the object, technical solutions and advantages of the present invention are clearer, below in conjunction with the accompanying drawings with specific embodiment pair
The present invention is described in detail.
The present invention provides a kind of display packing of browser page, and the method includes:
Default page code file is parsed and is rendered, obtained the page showing;The described page includes page 1
Head, the first footer and document, described document includes the second top margin, content and the second footer, described first top margin and the first footer
Attribute be to be not take up document, the attribute of described second top margin and the second footer is to take document.
Fig. 5 is the schematic flow sheet of the preferred embodiment one of the display packing that the present invention realizes browser page, as Fig. 5 institute
Show, the preferred embodiment comprises the following steps:
Step 501, replicates the first top margin code in page code file and the first footer code, obtained for the second top margin generation
Code and the page code file of the second footer code;In wherein said first top margin code and the first footer code, the first top margin
Positioning properties with the first footer are to fix, in the second top margin code and the second footer code, by the second top margin and page 2
The positioning properties of foot are set to static state, and described positioning properties are the second static top margin and the second footer takies document.
Specifically, in generating page code file processes, browser receive user inputs in page code file
Two identical top margin codes and two identical footer codes, wherein, the first top margin code and the first footer code are respectively
The original top margin code of user input and original footer code, the second top margin code and the second footer code are respectively duplicated
First top margin code and duplicated first footer code, the second top margin code and the second footer code are users to the first top margin
Code and the first footer code are input in page code file after being replicated;Or, after generating page code file, right
The code compiling is needed to add unique identifier, for example, to the first top margin generation in page code file in page code file
Code and the first footer code add duplication identifier;The page code file consolidation needing compiling is uploaded to back-end services by user
Under the particular category of device, compiler finds according to the path of user input needs the page code file of compiling, and compiler is to adding
Plus the page code file of unique identifier is compiled, if the first top margin code and the first footer generation in page code file
Code is added with duplication identifier, then compiler is carried out to the first top margin code and the first footer code that are added with duplication identifier
Replicate;After compiler is compiled to page code file, export the page code file after compiling, in the present embodiment, compiling
Two identical top margin codes and two identical footer codes, wherein page 1 will be comprised in the page code file of device output
Head code and the first footer code respectively original top margin code of user input and original footer code, the second top margin code and the
Two footer codes are respectively the first top margin code and the duplicated first footer code that compiler self-replication goes out;So, right
Including two identical top margin codes and two identical footer codes page code file parsed and rendered after, obtain
The page in there will be two top margins and two footers;In the preferred embodiment of the present invention, user is the exploit person of browser page
Member.
In the second top margin code and the second footer code, weight is carried out to the association attributes of the second top margin and the second footer
Put, including the replacement of positioning properties and display characteristic attribute;Wherein, the replacement of positioning properties is by the second top margin and the second footer
Positioning properties reset to static state, the default value due to position field in the first top margin code and the first footer code is
Fixed, represents that positioning properties are to fix, then replicating the second top margin obtaining and the positioning properties of the second footer is also to fix,
It is defaulted as departing from document, after page code file is loaded, the second top margin and the second page footing are fixed position in browser forms,
In the present embodiment, need to be changed to the assignment of the position field in the second top margin code and the second footer code by fixed
Static, represents that the positioning properties of the second top margin and the second footer are static state, and that is, the second top margin and the second footer be without departing from document,
Take document, after page code file is loaded, the second top margin and the second page footing belong to a part for document, and in a document
Position is fixed, and is located at the two ends of document;The replacement of display characteristic attribute is by the display characteristic of the second top margin and the second page footing
Attribute reset to hiding, due to visibility field in the first top margin code and the first footer code default value be sky,
After page code file is loaded, the first top margin and the first footer can show in browser forms, in the present embodiment, need
The assignment of the visibility field replicating in the second top margin code and the second footer code obtaining is changed to hidden by sky,
I.e. the second top margin and the second footer do not show, after page code file is loaded, the second top margin and the second footer are in browser window
Do not show in body, will be blank above the content of document and below content, the blank of top takies document but do not show
Second top margin, the blank of lower section is to take document but the second footer of not showing;Here, the replacement of display characteristic attribute is optional
The display characteristic attribute of the second top margin and the second footer, in order to reach more preferable visual effect, can be reset to hiding by operation.
Step 502, parses and renders the page code file comprising two top margin codes and two footer codes, shown
The page showing;The attribute of described first top margin and the first footer is to be not take up document, the genus of described second top margin and the second footer
Property for take document.
Specifically, first, the file address of browser receiving user's input, according to this document address in back-end server
Find corresponding page code file;Secondly, the page to two top margin codes of the inclusion found and two footer codes for the browser
Face code file is parsed, and obtains dom tree;Then;The document dbject model that browser obtains to parsing(DOM, Document
Object Model)Tree is rendered, and obtains the page showing;Wherein, dom tree is the group shaping of multiple display objects in the page
Formula, dom tree is used for limiting the logical relation between code and attribute in page code file;Wherein, due to the first top margin code and
In first footer code, the positioning properties of the first top margin and the first footer are defaulted as fixing, therefore, the first top margin and the first footer
Depart from document, browser resolves after rendering page code file, the first top margin and the first footer position in browser forms
Fixing;And in the second top margin code and the second footer code, the positioning properties of the second top margin and the second footer are static state, therefore,
Second top margin and the second footer without departing from document, that is, take document, to page code document analysis and after rendering, the second top margin and
Second footer belongs to a part for document, and position is fixed in a document, and is individually fixed in the two ends of document;Due to positioning properties
Display layer for the first fixing top margin and the second footer is superior to the second top margin that positioning properties are static state and the second footer
Display layer rank, the therefore first top margin and the first footer acquiescence be displayed on the second top margin and the and the upper strata of footer, but
Because the second top margin and the second footer belong to a part for document and display characteristic attribute is not show, the second top margin and page 2
Foot is located at the two ends of document so that the two ends in document are blank as virtual top margin and footer, when the second top margin is located at
During browser forms top, even if the second top margin covers document, also only cover virtual the second top margin in document, that is, cover literary composition
The blank parts on shelves top, are not covered with the content in document, in the same manner, when the second footer is located at browser bottom, even if the
One footer covers document, also only covers virtual the second footer in document, that is, covers the blank parts of bottom in document, do not have
There is the content covering in document.
Fig. 6 is the schematic flow sheet of the preferred embodiment two of the composition method that the present invention realizes browser page, as Fig. 6 institute
Show, the preferred embodiment comprises the following steps:
Step 601, parses to default page code file, obtains showing object, replicates the in display object
One top margin object and the first footer object, obtain the second top margin object and the second footer object;Wherein said first top margin object
In the CSS of the first footer object, the positioning properties of the first top margin and the first footer are to fix, in the second top margin object and
In the CSS of the second footer object, the positioning properties of the second top margin and the second footer are set to static state, wherein, described positioning
Attribute is the second static top margin and the second footer takies document.
Specifically, the file address of browser receiving user's input, finds in back-end server according to this document address
Corresponding page code file;Browser parses to the page code file finding, and obtains dom tree;Wherein, dom tree is
The composition form of multiple display objects in the page;User calls the interface function of JavaScript script offer by HTML mode
DomObject.cloneNode (), sends order to browser;Browser is aobvious according to indicate in the order receiving and this order
Show object, know and need the first top margin object and the first footer object are replicated;Browser creates one on described dom tree
Individual new branch, new branch is branch at the same level with the branch of the first top margin object and the first footer object, replicates the obtaining
, as the leaf node of new branch, so, dom tree has two identical top margins pair for two top margin objects and the second footer object
As with two identical footer objects.
Association attributes in the CSS of the second top margin object and the second footer object, to the second top margin and the second footer
Reset, including the replacement of positioning properties and display characteristic attribute;Wherein, by the second top margin object and the second footer object
The assignment of the position field in CSS is changed to static by the fixed giving tacit consent to, and represents the second top margin and the second footer
Positioning properties are static state, and that is, the second top margin and the second footer, without departing from document, take document, after browser renders to dom tree,
Second top margin and the second footer belong to a part for document, and position is fixed in a document, and are located at the two ends of document;By second
The assignment of the visibility field in the CSS of top margin object and the second footer object is changed to hidden by the sky given tacit consent to, that is,
Second top margin and the second footer do not show, after browser renders to dom tree, the second top margin and the second footer are in browser forms
In do not show, above the content of document and will be blank below content, the blank of top be occupancy document but do not show the
Two top margins, the blank of lower section is to take document but the second footer of not showing;Here, the replacement of display characteristic attribute is optional behaviour
Make, in order to reach more preferable visual effect, the display characteristic attribute of the second top margin and the second footer can be reset to hiding.
Step 602, the display object that parsing is obtained renders, and obtains the page showing;Described first top margin and
The attribute of one footer is to be not take up document, and the attribute of described second top margin and the second footer is to take document.
Specifically, browser is being parsed to page code file and is being obtained two identical top margin objects and footer pair
As rear, dom tree is rendered, obtain the page showing;Wherein, the first top margin and the first footer depart from document, are shown
The page after, the first top margin and the first footer are fixed position in browser forms;Second top margin object and the second footer object
In, the positioning properties of the second top margin and the second footer are static state, and the second top margin and the second footer without departing from document, that is, take literary composition
Shelves, after obtaining the page, the second top margin and the second footer belong to a part for document, fix in a document, and are individually fixed in literary composition
The two ends of shelves;When the second top margin is located at browser forms top, the first top margin covers virtual the second top margin in document, does not have
Cover the content in document, in the same manner, when the second footer is located at browser bottom, the first footer covers virtual second in document
Footer, is not covered with the content in document.
In above preferred embodiment, original top margin and footer are used for showing as real top margin and footer, copy
Top margin and footer as virtual top margin and footer occupy-place in a document, do not knowing top margin height and footer height in advance
Under the premise of, original top margin and footer can either be avoided to cover the content of document, can ensure that in the page of display simultaneously again
There is top margin and footer, reduce development cost and the maintenance cost of the page, improve development efficiency;Further, since not utilizing
JavaScript framework, or carry out showing the duplication of object merely with JavaScript framework, simple to operate, therefore by above-mentioned skill
When art scheme is applied to Android terminal, also will not clash with browser, it is to avoid browser collapses;Additionally, utilizing
Compiler replicates to top margin code and footer code, and the side that browser is replicated to top margin object and footer object
During case, if necessary to be adjusted to the content of top margin and footer, then can only change original top margin and footer, compiler or
Browser can replicate to amended top margin and footer automatically, can reduce maintenance cost, improves development efficiency.
For realizing said method, the present invention also provides a kind of composing system of browser page, and it is clear that Fig. 7 is that the present invention realizes
Look at the device page the preferred embodiment one of composing system structural representation, Fig. 8 is the typesetting that the present invention realizes browser page
The structural representation of the preferred embodiment two of system, as shown in Figure 7 and Figure 8, this system includes browser;Described browser includes
Resolution unit 11 and rendering unit 12;Wherein,
Resolution unit 11, for parsing to default page code file;
Rendering unit 12, for rendering to the page code file after resolution unit 11 parsing, obtains the page showing
Face;The described page comprises the first top margin, the first footer and document, and the attribute of described first top margin and the first footer is to be not take up literary composition
Shelves, the attribute of described second top margin and the second footer is to take document.
As shown in fig. 7, this system also includes:
Copied cells 13, for replicating the first top margin code in page code file and the first footer code, obtains
Two top margin codes and the page code file of the second footer code;In wherein said first top margin code and the first footer code,
The positioning properties of the first top margin and the first footer are to fix, in the second top margin code and the second footer code, by the second top margin
It is set to static state with the positioning properties of the second footer, described positioning properties are the second static top margin and the second footer takies literary composition
Shelves.
Wherein, when described copied cells 13 is located at browser, top margin in replicating page code file for the copied cells 13
When code and footer code, specially:
Receive user replicates respectively to the first top margin code in parent page code file and the first footer code
The the second top margin code obtaining afterwards and the second footer code.
Wherein, when described copied cells 13 is located at compiler, described copied cells 13 is in replicating page code file
When top margin code and footer code, specially:
Described page code file is found according to the path of input, in described page code file, comprises that there is duplication mark
First top margin code of symbol and the first footer code, when being compiled to described page code file, replicate mark according to described
Knowledge symbol carries out duplication to described first top margin code and the first footer code and obtains the second top margin code and the second footer code.
Wherein, described copied cells 13, is additionally operable in the second top margin code and the second footer code, by the second top margin and
The display characteristic attribute of the second footer is set to hide;Wherein, described display characteristic attribute is hiding the second top margin and second
Footer does not appear in browser forms.
As shown in figure 8, described resolution unit 11 further includes to parse subelement 110, replicate subelement 112;Wherein,
Described parsing subelement 110, for parsing to described page code file, obtains showing object;
Described duplication subelement 112, for replicating the first top margin object and the first footer object in display object, obtains
Second top margin object and the second footer object;In the CSS of wherein said first top margin object and the first footer object, first
The positioning properties of top margin and the first footer are to fix;It is additionally operable to the CSS in described second top margin object and the second footer object
In, the positioning properties of the second top margin and the second footer are set to static state, wherein, described positioning properties are the second static top margin
Take document with the second footer.
Wherein, when described duplication subelement 112 shows the first top margin object and the first footer object in object in duplication,
It is specially:
According to the display object of instruction in the order receiving and described order, to the first top margin object and the first footer object
Replicated;
The dom tree of described display object composition creates new branch, described new branch and the first top margin object and
The branch of the first footer object is at the same level;
The the second top margin object obtaining and the second footer object leaf node as new branch will be replicated.
Wherein, described duplication subelement 112, is additionally operable to the CSS in described second top margin object and the second footer object
In, the display characteristic attribute of the second top margin and the second footer is set to hide;Wherein, described display characteristic attribute is hiding
Second top margin and the second footer do not appear in browser forms.
For example, classical example is the details within mobile member card and list page, as shown in figure 9, wherein, list is interior
Hold, the top screening information such as item is top margin, lower state hurdle be footer it can be seen that content number do not interfere with the whole of the page
The change of body layout, as shown in Figure 10, compared with Fig. 9, after in the top margin in Figure 10, screening item is opened, the size of content area is sent out
Give birth to change, but the size of integral layout and the page has not changed, android terminal can drag content in the page and carry out
Roll, only the list items in content roll with the page.
The foregoing is only presently preferred embodiments of the present invention, not in order to limit the present invention, all essences in the present invention
Within god and principle, any modification, equivalent substitution and improvement done etc., should be included within the scope of protection of the invention.