CN105468606A - Webpage saving method and device - Google Patents

Webpage saving method and device Download PDF

Info

Publication number
CN105468606A
CN105468606A CN201410422472.6A CN201410422472A CN105468606A CN 105468606 A CN105468606 A CN 105468606A CN 201410422472 A CN201410422472 A CN 201410422472A CN 105468606 A CN105468606 A CN 105468606A
Authority
CN
China
Prior art keywords
attribute
preset format
property value
reference list
character string
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
Application number
CN201410422472.6A
Other languages
Chinese (zh)
Other versions
CN105468606B (en
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 CN201410422472.6A priority Critical patent/CN105468606B/en
Publication of CN105468606A publication Critical patent/CN105468606A/en
Application granted granted Critical
Publication of CN105468606B publication Critical patent/CN105468606B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Landscapes

  • Information Transfer Between Computers (AREA)
  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)

Abstract

The invention discloses a webpage saving method and device, and can effectively avoid an abnormal situation generated when a saved webpage is loaded again. The method comprises the following steps: obtaining JS (JavaScript) environment corresponding to the node tree of a webpage, and obtaining a global object associated with the JS environment; and according to the global object, a serialization rule, a preset referenced table and a preset mapping table, generating an object of a preset format, wherein the referenced table comprises a corresponding relationship between the attribute of the object of the preset format and a unique identifier, and the mapping table comprises a corresponding relationship between the unique identifier and an attribute value address. The technical scheme of the invention can save various variables generated in a program execution process while the webpage is saved, and therefore, the abnormal situation generated when the saved webpage is loaded can be effectively avoided.

Description

The method that webpage is preserved and device
Technical field
The disclosure relates to Internet technical field, particularly relates to method and the device of webpage preservation.
Background technology
Today so flourishing in internet, people almost can browse webpage every day, various information is known by webpage, sometimes, after we open certain or some webpages, finish watching due to not free, and the information of webpage is very important or very interested to us, carefully seeing again when needing to wait until free, at this moment just need webpage to save, then by reloading webpage, the content of webpage being reduced.
The process that webpage is preserved is mainly to the serialization process of web page contents.In the preservation process of webpage, due to the execution of JS script, create various JS variable.These variablees play an important role in the script implementation in future.And current webpage preserving type fails to be preserved due to JS variable, after causing the page be saved to reload, often there is various abnormal situation.
Summary of the invention
For overcoming Problems existing in correlation technique, disclosure embodiment provides store method and the device of webpage, the various variablees that can produce in save routine implementation while webpage is preserved, thus there is abnormal situation when can effectively avoid the webpage preserved to reload.
According to the first aspect of disclosure embodiment, a kind of webpage store method is provided, comprises:
Obtain the JS environment that the node tree of webpage is corresponding, and obtain the environmentally hazardous global object of described JS;
According to described global object, serializing rule, the reference list preset and default mapping table, generate preset format object, wherein, described reference list comprises attribute and the uniquely identified corresponding relation of described preset format object, and described mapping table comprises the corresponding relation of described unique identification and property value address;
By described reference list and described preset format object merging, generate the preset format file of described webpage.
In one embodiment, described according to described global object, serializing rule, the reference list preset and default mapping table, generate preset format object, can comprise:
When the type of the attribute of described global object is built-in type, digit group type or casement, the property value of described attribute is converted to the property value of described preset format, according to the attribute value generation preset format object of described preset format;
When the type of the attribute of described global object is function type, the function body of described attribute is converted to character string, and adds preset function prefix, according to the text string generation preset format object adding described preset function prefix;
When the type of the attribute of described global object is object type, judge whether the address of the property value of described attribute is present in described mapping table, when it is present, according to described reference list, described property value sequence is turned to the index information of described reference list, the title according to described index information and described attribute generates preset format object; When not existing, according to described property value, described attribute is converted to the attribute of preset format object, for the setup of attribute unique identification of described preset format object, and the attribute of described unique identification and described preset format object is added in described reference list, and according to described reference list, described property value sequence being turned to the index information of described reference list, the title according to described index information and described attribute generates preset format object.
In one embodiment, described preset format can be JSON form.
In one embodiment, said method also can comprise:
Read the preset format file of described webpage, obtain described preset format object;
According to described preset format object, unserializing rule, described mapping table and described reference list, generate global object;
JS environment is created according to described global object;
Utilize described JS creating environments node tree.
In one embodiment, described according to described preset format object, unserializing rule, described mapping table and described reference list, generate global object, can comprise:
When the property value of the attribute of described preset format object is numerical value, null value, Boolean, array or the character string not with prefix, described property value is converted to JS value, according to title and the attribute value generation global object being converted to JS value of described attribute;
When the property value of the attribute of described preset format object is the character string of band preset function prefix, this character string is converted to JS function as function body, according to title and the described JS function generation global object of described attribute;
When the property value of the attribute of described preset format object is the character string being with described reference list index information prefix, using this character string as unique identification, judge whether this character string is present in described mapping table; When it is present, obtain the property value address of described attribute according to described mapping table, obtain the attribute of preset format object corresponding to this character string according to described reference list, generate global object according to the property value address of described attribute and the title of described attribute; When not existing, create the attribute of a global object, the attribute of preset format object corresponding to this character string is searched in described reference list, the attribute of preset format object corresponding according to this character string and the attribute of the global object of described establishment, this character string and property value address corresponding to this character string are added in mapping table, and generates global object according to the title of this attribute and property value address.
According to the second aspect of disclosure embodiment, the device providing a kind of webpage to preserve, comprising:
Acquisition module, the JS environment that the node tree for obtaining webpage is corresponding, and obtain the environmentally hazardous global object of described JS;
First generation module, for according to described global object, serializing rule, preset reference list and default mapping table, generate preset format object, wherein, described reference list comprises attribute and the uniquely identified corresponding relation of described preset format object, and described mapping table comprises the corresponding relation of described unique identification and property value address;
Merge module, for by described reference list and described preset format object merging, generate the preset format file of described webpage.
In one embodiment, described first generation module can comprise:
First generates submodule, when the type for the attribute when described global object is built-in type, digit group type or casement, the property value of described attribute is converted to the property value of described preset format, according to the attribute value generation preset format object of described preset format;
Second generates submodule, when the type for the attribute when described global object is function type, the function body of described attribute is converted to character string, and adds preset function prefix, according to the text string generation preset format object adding described preset function prefix;
3rd generates submodule, when type for the attribute when described global object is object type, judge whether the address of the property value of described attribute is present in described mapping table, when it is present, according to described reference list, described property value sequence is turned to the index information of described reference list, the title according to described index information and described attribute generates preset format object; When not existing, according to described property value, described attribute is converted to the attribute of preset format object, for the setup of attribute unique identification of described preset format object, and the attribute of described unique identification and described preset format object is added in described reference list, and according to described reference list, described property value sequence being turned to the index information of described reference list, the title according to described index information and described attribute generates preset format object.
In one embodiment, described preset format can be JSON form.
In one embodiment, said apparatus also can comprise:
Read module, for reading the preset format file of described webpage, obtains described preset format object;
Second generation module, for according to described preset format object, unserializing rule, described mapping table and described reference list, generates global object;
First creation module, for creating JS environment according to described global object;
Second creation module, for utilizing described JS creating environments node tree.
In one embodiment, described second generation module can comprise:
4th generates submodule, when property value for the attribute when described preset format object is numerical value, null value, Boolean, array or the character string not with prefix, described property value is converted to JS value, according to title and the attribute value generation global object being converted to JS value of described attribute;
5th generates submodule, when the property value for the attribute when described preset format object is the character string of band preset function prefix, this character string is converted to JS function as function body, according to title and the described JS function generation global object of described attribute;
6th generates submodule, when the property value for the attribute when described preset format object is the character string being with described reference list index information prefix, using this character string as unique identification, judges whether this character string is present in described mapping table; When it is present, obtain the property value address of described attribute according to described mapping table, obtain the attribute of preset format object corresponding to this character string according to described reference list, generate global object according to the property value address of described attribute and the title of described attribute; When not existing, create the attribute of a global object, the attribute of preset format object corresponding to this character string is searched in described reference list, the attribute of preset format object corresponding according to this character string and the attribute of the global object of described establishment, this character string and property value address corresponding to this character string are added in mapping table, and generates global object according to the title of this attribute and property value address.
According to the third aspect of disclosure embodiment, the device providing a kind of webpage to preserve, comprising:
Processor;
For the storer of storage of processor executable instruction;
Wherein, described processor is configured to:
Obtain the JS environment that the node tree of webpage is corresponding, and obtain the environmentally hazardous global object of described JS;
According to described global object, serializing rule, the reference list preset and default mapping table, generate preset format object, wherein, described reference list comprises attribute and the uniquely identified corresponding relation of described preset format object, and described mapping table comprises the corresponding relation of described unique identification and property value address;
By described reference list and described preset format object merging, generate the preset format file of described webpage.
The technical scheme that embodiment of the present disclosure provides can comprise following beneficial effect:
The various variablees that can produce in save routine implementation while webpage is preserved, thus there is abnormal situation when avoiding the webpage preserved to reload.Meet the demand of user, user can be made to check complete info web.
Should be understood that, it is only exemplary and explanatory that above general description and details hereinafter describe, and can not limit the disclosure.
Accompanying drawing explanation
Accompanying drawing to be herein merged in instructions and to form the part of this instructions, shows embodiment according to the invention, and is used from instructions one and explains principle of the present invention.
Fig. 1 is the process flow diagram of the method that the webpage according to an exemplary embodiment is preserved.
Fig. 2 is the process flow diagram of the method that the another kind of webpage according to an exemplary embodiment is preserved.
Fig. 3 is the process flow diagram of the method that the webpage according to an exemplary embodiment one is preserved.
Fig. 4 is the process flow diagram of the method that the webpage according to an exemplary embodiment two is preserved.
Fig. 5 is the block diagram of the device that a kind of webpage according to an exemplary embodiment is preserved.
Fig. 6 is the block diagram of the device that the another kind of webpage according to an exemplary embodiment is preserved.
Fig. 7 is a kind of block diagram being applicable to the device that webpage is preserved according to an exemplary embodiment.
Embodiment
Here will be described exemplary embodiment in detail, its sample table shows in the accompanying drawings.When description below relates to accompanying drawing, unless otherwise indicated, the same numbers in different accompanying drawing represents same or analogous key element.Embodiment described in following exemplary embodiment does not represent all embodiments consistent with the present invention.On the contrary, they only with as in appended claims describe in detail, the example of apparatus and method that aspects more of the present invention are consistent.
Figure 1 shows that the method that a kind of webpage that disclosure embodiment provides is preserved, the method is used for mobile Internet terminal, and internet terminal can be computer, mobile phone, intelligent television and any terminal device that can be connected to internet with display screen.As shown in Figure 1, the method comprises the steps S101-S103:
In step S101, obtain the JS environment that the node tree of webpage is corresponding, and obtain the environmentally hazardous global object of JS.
Wherein, webpage through resolving is represented as node tree, and browser is that each node tree distributes a JS environment, JS environmentally hazardous be referred to as the JS object of global object, in this step, system obtains JS environment corresponding to node tree and the environmentally hazardous global object of JS.
In step s 102, according to global object, serializing rule, the reference list preset and default mapping table, generate preset format object, wherein, reference list comprises attribute and the uniquely identified corresponding relation of preset format object, and mapping table comprises the corresponding relation of unique identification and property value address.
Wherein, global object is the JS object environmentally hazardous with JS, is made up of a series of attribute, and each attribute comprises Property Name and property value.
Sequence turns to process JS object being converted to byte sequence.
The sequence of attributes of preset format object in reference list, and is given attribute assignment unique identification, the attribute of preset format object and the unique identification one_to_one corresponding of distribution of preset format object by system.Such as: reference list can be represented with r " <ID> ", then " a ": r " 1 " represent the value of attribute a be designated in reference list 1 object.
Mapping table comprises the one-to-one relationship of above-mentioned unique identification and property value address.
In one embodiment, step S102 can be embodied as:
When the type of the attribute of global object is built-in type, digit group type or casement, the property value of attribute is converted to the property value of preset format, according to the attribute value generation preset format object of preset format.Such as, preset format can be JSON form.
When the type of the attribute of global object is function type, the function body of attribute is converted to character string, and adds preset function prefix, according to the text string generation preset format object adding preset function prefix.Preset function prefix can be f.
When the type of the attribute of global object is object type, judge whether the address of the property value of attribute is present in mapping table, when it is present, according to reference list, property value sequence is turned to the index information of reference list, the title according to index information and attribute generates preset format object; When not existing, according to property value, attribute is converted to the attribute of preset format object, for the setup of attribute unique identification of preset format object, and the attribute of unique identification and preset format object is added in reference list, and according to reference list, property value sequence being turned to the index information of reference list, the title according to index information and attribute generates preset format object.Wherein, index is the tag system in access information resource " address " or " source ".
In step s 103, by reference list and preset format object merging, the preset format file of generating web page.
So far, the said method that disclosure embodiment provides, the various variablees that can produce in save routine implementation while webpage is preserved, thus there is abnormal situation when avoiding the webpage preserved to reload.Meet the demand of user, user can be made to check complete info web.
In one embodiment, above-mentioned preset format can be JSON form.
In one embodiment, said method also can comprise the steps S104-S107:
In step S104, read the preset format file of webpage, obtain preset format object.Preset format can be JSON form.
In step S105, according to preset format object, unserializing rule, mapping table and reference list, generate global object.
Be deserialized as process byte sequence being reverted to JS object.
In one embodiment, step S105 can be embodied as:
When the property value of the attribute of preset format object is numerical value, null value, Boolean, array or the character string not with prefix, property value is converted to JS value, according to title and the attribute value generation global object being converted to JS value of attribute.
When the property value of the attribute of preset format object is the character string of band preset function prefix, this character string is converted to JS function as function body, according to title and the described JS function generation global object of attribute.Preset function prefix can be f.
When the property value of the attribute of preset format object is the character string being with described reference list index information prefix, using this character string as unique identification, judge whether this character string is present in mapping table; When it is present, obtain the property value address of attribute according to mapping table, obtain the attribute of preset format object corresponding to this character string according to reference list, generate global object according to the property value address of attribute and the title of attribute; When not existing, create the attribute of a global object, the attribute of preset format object corresponding to this character string is searched in reference list, the attribute of preset format object corresponding according to this character string and the attribute of the global object of establishment, this character string and property value address corresponding to this character string are added in mapping table, and generates global object according to the title of this attribute and property value address.
In step s 106, JS environment is created according to global object.
In step s 107, JS creating environments node tree is utilized.
With specific embodiment, the technical scheme that disclosure embodiment provides is described below.
Embodiment one
The said method that embodiment one utilizes disclosure embodiment to provide, for user preserves webpage, it is applied in following scene: user's open any browser browses webpage, and intends to preserve a certain webpage.Wherein, global object o represents, unique identification ID represents, reference list r represents, mapping table m represents, as shown in Figure 3, next system proceeds as follows:
As shown in Figure 3, the present embodiment comprises the steps:
In step s 201, system obtains the global object of JS environment, is designated as o.Initialization reference list r.Set up property value address/ID mapping table m.
In step S202, system creation json object g, all properties of traversal o, if attribute type is built-in type, digit group type or casement, is converted to JSON form, and adds j by property value.Wherein, j is json object.
In step S203, if attribute type is function type, function body is converted to character string, and adds prefix f, add f.Wherein, f is json object.
In step S204, if attribute type is object type, remember that its value is o'.Check that whether Already in the property value address of o' in mapping table m.
In step S205, when being present in mapping table m, find the ID that o' is corresponding, the value sequence of o' turned to r " <ID> ", insert in g together with Property Name.
In step S206, when not being present in mapping table m, taking o' as parameter Recursion Application step S202, obtaining the g' that o' is corresponding.Distribute a new ID; ID and g' is inserted in reference list r; The property value address of o' and ID are inserted in m; By Property Name and r " <ID> " insert in g.
In step S207, reference list r and json object g merges by system, and is converted to text.Wherein, text can be JSON form.
Embodiment two
The said method that embodiment two utilizes disclosure embodiment to provide, for user preserves webpage, it is applied in following scene: user saves webpage according to the method described in embodiment one, and present user wants the webpage reloading this preservation.Wherein, global property g represents, unique identification ID represents, reference list r represents, mapping table m represents, as shown in Figure 4, next system proceeds as follows:
In step S301, system reads the text in embodiment one step S207, obtains json object j.From j, obtain reflecting attribute, be designated as r; From j, obtain global property, be designated as g.Create JS object o.Create ID/ property value address mapping table m.
In step s 302, all properties of traversal g, if property value is numerical value, null, Boolean, array or the character string not with prefix, is converted to JS value, inserts o together with attribute-name by property value.
In step S303, if property value is the character string of band prefix f, character string is converted to JS function as function body, inserts o together with attribute-name.
In step s 304, if property value is the character string of band prefix r, using character string as ID, in mapping table m, ID is searched.
In step S305, if there is above-mentioned ID in mapping table m, then obtain object attribute values address o' corresponding to ID, attribute-name and o' are inserted o.
In step S306, otherwise, create new JS object o'.From r, JSON object g' corresponding to ID is obtained according to ID.Be parameter Recursion Application step S302 with g', o'.ID and o' is inserted in mapping table m.Attribute-name and o' are inserted in o.
In step S307, create JS environment with o as global object.
About the device in above-described embodiment, wherein the concrete mode of modules executable operations has been described in detail in about the embodiment of the method, will not elaborate explanation herein.
Fig. 5 is the block diagram of the device that a kind of webpage according to an exemplary embodiment is preserved, and as shown in Figure 5, the device that this webpage is preserved comprises:
Acquisition module 51, the JS environment that the node tree for obtaining webpage is corresponding, and obtain the environmentally hazardous global object of JS;
First generation module 52, for according to global object, serializing rule, preset reference list and default mapping table, generate preset format object, wherein, reference list comprises attribute and the uniquely identified corresponding relation of preset format object, and mapping table comprises the corresponding relation of unique identification and property value address;
Merge module 53, for by reference list and preset format object merging, the preset format file of generating web page.
In one embodiment, above-mentioned first generation module can comprise:
First generates submodule, when the type for the attribute when global object is built-in type, digit group type or casement, the property value of attribute is converted to the property value of preset format, according to the attribute value generation preset format object of preset format;
Second generates submodule, when the type for the attribute when global object is function type, the function body of attribute is converted to character string, and adds preset function prefix, according to the text string generation preset format object adding preset function prefix;
3rd generates submodule, when type for the attribute when global object is object type, judge whether the address of the property value of attribute is present in mapping table, when it is present, according to reference list, property value sequence is turned to the index information of reference list, the title according to index information and attribute generates preset format object; When not existing, according to property value, attribute is converted to the attribute of preset format object, for the setup of attribute unique identification of preset format object, and the attribute of unique identification and preset format object is added in reference list, and according to reference list, property value sequence being turned to the index information of reference list, the title according to index information and attribute generates preset format object.
In one embodiment, above-mentioned preset format is JSON form.
In one embodiment, as shown in Figure 6, said apparatus also can comprise:
Read module 54, for reading the preset format file of webpage, obtains preset format object;
Second generation module 55, for according to preset format object, unserializing rule, mapping table and reference list, generates global object;
First creation module 56, for creating JS environment according to global object;
Second creation module 57, for utilizing JS creating environments node tree.
In one embodiment, above-mentioned second generation module can comprise:
4th generates submodule, when property value for the attribute when preset format object is numerical value, null value, Boolean, array or the character string not with prefix, property value is converted to JS value, according to title and the attribute value generation global object being converted to JS value of attribute;
5th generates submodule, when the property value for the attribute when preset format object is the character string of band preset function prefix, this character string is converted to JS function as function body, according to title and the JS function generation global object of attribute;
6th generates submodule, when the property value for the attribute when preset format object is the character string of band reference list index information prefix, using this character string as unique identification, judges whether this character string is present in mapping table; When it is present, obtain the property value address of attribute according to mapping table, obtain the attribute of preset format object corresponding to this character string according to reference list, generate global object according to the property value address of attribute and the title of attribute; When not existing, create the attribute of a global object, the attribute of preset format object corresponding to this character string is searched in reference list, the attribute of preset format object corresponding according to this character string and the attribute of the global object of establishment, this character string and property value address corresponding to this character string are added in mapping table, and generates global object according to the title of this attribute and property value address.
The said apparatus that disclosure embodiment provides, the various variablees that can produce in save routine implementation while webpage is preserved, thus there is abnormal situation when avoiding the webpage preserved to reload.Meet the demand of user, user can be made to check complete info web.
Fig. 7 is the block diagram of a kind of save set 1200 for webpage according to an exemplary embodiment, and this device is applicable to terminal device.Such as, device 1200 can be mobile phone, computing machine, digital broadcast terminal, messaging devices, game console, tablet device, Medical Devices, body-building equipment, personal digital assistant etc.
With reference to Fig. 7, device 1200 can comprise following one or more assembly: processing components 1202, storer 1204, power supply module 1206, multimedia groupware 1208, audio-frequency assembly 1210, the interface 1212 of I/O (I/O), sensor module 1214, and communications component 1216.
The integrated operation of the usual control device 1200 of processing components 1202, such as with display, call, data communication, camera operation and record operate the operation be associated.Treatment element 1202 can comprise one or more processor 1220 to perform instruction, to complete all or part of step of above-mentioned method.In addition, processing components 1202 can comprise one or more module, and what be convenient between processing components 1202 and other assemblies is mutual.Such as, processing element 1202 can comprise multi-media module, mutual with what facilitate between multimedia groupware 1208 and processing components 1202.
Storer 1204 is configured to store various types of data to be supported in the operation of equipment 1200.The example of these data comprises for any application program of operation on device 1200 or the instruction of method, contact data, telephone book data, message, picture, video etc.Storer 1204 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.
The various assemblies that electric power assembly 1206 is device 1200 provide electric power.Electric power assembly 1206 can comprise power-supply management system, one or more power supply, and other and the assembly generating, manage and distribute electric power for device 1200 and be associated.
Multimedia groupware 1208 is included in the screen providing an output interface between device 1200 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 one or more touch sensor with the gesture on sensing touch, slip and touch panel.Touch sensor can the border of not only sensing touch or sliding action, but also detects the duration relevant with touch or slide and pressure.In certain embodiments, multimedia groupware 1208 comprises a front-facing camera and/or post-positioned pick-up head.When equipment 1200 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 1210 is configured to export and/or input audio signal.Such as, audio-frequency assembly 1210 comprises a microphone (MIC), and when device 1200 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 received can be stored in storer 1204 further or be sent via communications component 1216.In certain embodiments, audio-frequency assembly 1210 also comprises a loudspeaker, for output audio signal.
I/O interface 1212 is for providing interface between processing components 1202 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 1214 comprises one or more sensor, for providing the state estimation of various aspects for device 1200.Such as, sensor module 1214 can detect the opening/closing state of equipment 1200, the relative positioning of assembly, such as described assembly is display and the keypad of device 1200, the position of all right pick-up unit 1200 of sensor module 1214 or device 1200 assemblies changes, the presence or absence that user contacts with device 1200, the temperature variation of device 1200 orientation or acceleration/deceleration and device 1200.Sensor module 1214 can comprise proximity transducer, be configured to without any physical contact time detect near the existence of object.Sensor module 1214 can also comprise optical sensor, as CMOS or ccd image sensor, for using in imaging applications.In certain embodiments, this sensor module 1214 can also comprise acceleration transducer, gyro sensor, Magnetic Sensor, pressure transducer or temperature sensor.
Communications component 1216 is configured to the communication being convenient to wired or wireless mode between device 1200 and other equipment.Device 1200 can access the wireless network based on communication standard, as WiFi, 2G or 3G, or their combination.In one exemplary embodiment, communication component 1216 receives from the broadcast singal of external broadcasting management system or broadcast related information via broadcast channel.In one exemplary embodiment, described communication component 1216 also comprises near-field communication (NFC) module, to promote junction service.Such as, can 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 1200 can be realized, for performing said method 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.
In the exemplary embodiment, additionally provide a kind of non-transitory computer-readable recording medium comprising instruction, such as, comprise the storer 1204 of instruction, above-mentioned instruction can perform said method by the processor 820 of device 1200.Such as, described non-transitory computer-readable recording medium can be ROM, random access memory (RAM), CD-ROM, tape, floppy disk and optical data storage devices etc.
A save set for webpage, comprising:
Processor;
For the storer of storage of processor executable instruction;
Wherein, processor is configured to:
Obtain the JS environment that the node tree of webpage is corresponding, and obtain the environmentally hazardous global object of described JS;
According to described global object, serializing rule, the reference list preset and default mapping table, generate preset format object, wherein, described reference list comprises attribute and the uniquely identified corresponding relation of described preset format object, and described mapping table comprises the corresponding relation of described unique identification and property value address;
By described reference list and described preset format object merging, generate the preset format file of described webpage.
This processor is also configured to: when the type of the attribute of described global object is built-in type, digit group type or casement, the property value of described attribute is converted to the property value of described preset format, according to the attribute value generation preset format object of described preset format;
When the type of the attribute of described global object is function type, the function body of described attribute is converted to character string, and adds preset function prefix, according to the text string generation preset format object adding described preset function prefix;
When the type of the attribute of described global object is object type, judge whether the address of the property value of described attribute is present in described mapping table, when it is present, according to described reference list, described property value sequence is turned to the index information of described reference list, the title according to described index information and described attribute generates preset format object; When not existing, according to described property value, described attribute is converted to the attribute of preset format object, for the setup of attribute unique identification of described preset format object, and the attribute of described unique identification and described preset format object is added in described reference list, and according to described reference list, described property value sequence being turned to the index information of described reference list, the title according to described index information and described attribute generates preset format object.
This processor is also configured to: described preset format is JSON form.
This processor is also configured to: the preset format file reading described webpage, obtains described preset format object;
According to described preset format object, unserializing rule, described mapping table and described reference list, generate global object;
JS environment is created according to described global object;
Utilize described JS creating environments node tree.
This processor is also configured to: when the property value of the attribute of described preset format object is numerical value, null value, Boolean, array or the character string not with prefix, described property value is converted to JS value, according to title and the attribute value generation global object being converted to JS value of described attribute;
When the property value of the attribute of described preset format object is the character string of band preset function prefix, this character string is converted to JS function as function body, according to title and the described JS function generation global object of described attribute;
When the property value of the attribute of described preset format object is the character string being with described reference list index information prefix, using this character string as unique identification, judge whether this character string is present in described mapping table; When it is present, obtain the property value address of described attribute according to described mapping table, obtain the attribute of preset format object corresponding to this character string according to described reference list, generate global object according to the property value address of described attribute and the title of described attribute; When not existing, create the attribute of a global object, the attribute of preset format object corresponding to this character string is searched in described reference list, the attribute of preset format object corresponding according to this character string and the attribute of the global object of described establishment, this character string and property value address corresponding to this character string are added in mapping table, and generates global object according to the title of this attribute and property value address.
A kind of non-transitory computer-readable recording medium, when the instruction in described storage medium is performed by the processor of mobile terminal, make mobile terminal can perform a kind of method of access router, described method comprises:
Obtain the JS environment that the node tree of webpage is corresponding, and obtain the environmentally hazardous global object of described JS;
According to described global object, serializing rule, the reference list preset and default mapping table, generate preset format object, wherein, described reference list comprises attribute and the uniquely identified corresponding relation of described preset format object, and described mapping table comprises the corresponding relation of described unique identification and property value address;
By described reference list and described preset format object merging, generate the preset format file of described webpage.
Described according to described global object, serializing rule, the reference list preset and default mapping table, generate preset format object, can comprise:
When the type of the attribute of described global object is built-in type, digit group type or casement, the property value of described attribute is converted to the property value of described preset format, according to the attribute value generation preset format object of described preset format;
When the type of the attribute of described global object is function type, the function body of described attribute is converted to character string, and adds preset function prefix, according to the text string generation preset format object adding described preset function prefix;
When the type of the attribute of described global object is object type, judge whether the address of the property value of described attribute is present in described mapping table, when it is present, according to described reference list, described property value sequence is turned to the index information of described reference list, the title according to described index information and described attribute generates preset format object; When not existing, according to described property value, described attribute is converted to the attribute of preset format object, for the setup of attribute unique identification of described preset format object, and the attribute of described unique identification and described preset format object is added in described reference list, and according to described reference list, described property value sequence being turned to the index information of described reference list, the title according to described index information and described attribute generates preset format object.
Described preset format can be JSON form.
Said method also can comprise:
Read the preset format file of described webpage, obtain described preset format object;
According to described preset format object, unserializing rule, described mapping table and described reference list, generate global object;
JS environment is created according to described global object;
Utilize described JS creating environments node tree.
Described according to described preset format object, unserializing rule, described mapping table and described reference list, generate global object, can comprise:
When the property value of the attribute of described preset format object is numerical value, null value, Boolean, array or the character string not with prefix, described property value is converted to JS value, according to title and the attribute value generation global object being converted to JS value of described attribute;
When the property value of the attribute of described preset format object is the character string of band preset function prefix, this character string is converted to JS function as function body, according to title and the described JS function generation global object of described attribute;
When the property value of the attribute of described preset format object is the character string being with described reference list index information prefix, using this character string as unique identification, judge whether this character string is present in described mapping table; When it is present, obtain the property value address of described attribute according to described mapping table, obtain the attribute of preset format object corresponding to this character string according to described reference list, generate global object according to the property value address of described attribute and the title of described attribute; When not existing, create the attribute of a global object, the attribute of preset format object corresponding to this character string is searched in described reference list, the attribute of preset format object corresponding according to this character string and the attribute of the global object of described establishment, this character string and property value address corresponding to this character string are added in mapping table, and generates global object according to the title of this attribute and property value address.
Those skilled in the art, at consideration instructions and after putting into practice disclosed herein disclosing, 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 the undocumented common practise in the art of the disclosure or conventional techniques means.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 amendment and change not departing from its scope.The scope of the present disclosure is only limited by appended claim.

Claims (11)

1. a method for webpage preservation, is characterized in that, comprising:
Obtain the JS environment that the node tree of webpage is corresponding, and obtain the environmentally hazardous global object of described JS;
According to described global object, serializing rule, the reference list preset and default mapping table, generate preset format object, wherein, described reference list comprises attribute and the uniquely identified corresponding relation of described preset format object, and described mapping table comprises the corresponding relation of described unique identification and property value address;
By described reference list and described preset format object merging, generate the preset format file of described webpage.
2. the method for claim 1, is characterized in that, described according to described global object, serializing rule, the reference list preset and default mapping table, generates preset format object, comprising:
When the type of the attribute of described global object is built-in type, digit group type or casement, the property value of described attribute is converted to the property value of described preset format, according to the attribute value generation preset format object of described preset format;
When the type of the attribute of described global object is function type, the function body of described attribute is converted to character string, and adds preset function prefix, according to the text string generation preset format object adding described preset function prefix;
When the type of the attribute of described global object is object type, judge whether the address of the property value of described attribute is present in described mapping table, when it is present, according to described reference list, described property value sequence is turned to the index information of described reference list, the title according to described index information and described attribute generates preset format object; When not existing, according to described property value, described attribute is converted to the attribute of preset format object, for the setup of attribute unique identification of described preset format object, and the attribute of described unique identification and described preset format object is added in described reference list, and according to described reference list, described property value sequence being turned to the index information of described reference list, the title according to described index information and described attribute generates preset format object.
3. the method for claim 1, is characterized in that, described preset format is JSON form.
4. method as claimed in claim 2 or claim 3, it is characterized in that, said method also comprises:
Read the preset format file of described webpage, obtain described preset format object;
According to described preset format object, unserializing rule, described mapping table and described reference list, generate global object;
JS environment is created according to described global object;
Utilize described JS creating environments node tree.
5. method as claimed in claim 4, is characterized in that, described according to described preset format object, unserializing rule, described mapping table and described reference list, generates global object, comprising:
When the property value of the attribute of described preset format object is numerical value, null value, Boolean, array or the character string not with prefix, described property value is converted to JS value, according to title and the attribute value generation global object being converted to JS value of described attribute;
When the property value of the attribute of described preset format object is the character string of band preset function prefix, this character string is converted to JS function as function body, according to title and the described JS function generation global object of described attribute;
When the property value of the attribute of described preset format object is the character string being with described reference list index information prefix, using this character string as unique identification, judge whether this character string is present in described mapping table; When it is present, obtain the property value address of described attribute according to described mapping table, obtain the attribute of preset format object corresponding to this character string according to described reference list, generate global object according to the property value address of described attribute and the title of described attribute; When not existing, create the attribute of a global object, the attribute of preset format object corresponding to this character string is searched in described reference list, the attribute of preset format object corresponding according to this character string and the attribute of the global object of described establishment, this character string and property value address corresponding to this character string are added in mapping table, and generates global object according to the title of this attribute and property value address.
6. a device for webpage preservation, is characterized in that, comprising:
Acquisition module, the JS environment that the node tree for obtaining webpage is corresponding, and obtain the environmentally hazardous global object of described JS;
First generation module, for according to described global object, serializing rule, preset reference list and default mapping table, generate preset format object, wherein, described reference list comprises attribute and the uniquely identified corresponding relation of described preset format object, and described mapping table comprises the corresponding relation of described unique identification and property value address;
Merge module, for by described reference list and described preset format object merging, generate the preset format file of described webpage.
7. device as claimed in claim 6, it is characterized in that, described first generation module comprises:
First generates submodule, when the type for the attribute when described global object is built-in type, digit group type or casement, the property value of described attribute is converted to the property value of described preset format, according to the attribute value generation preset format object of described preset format;
Second generates submodule, when the type for the attribute when described global object is function type, the function body of described attribute is converted to character string, and adds preset function prefix, according to the text string generation preset format object adding described preset function prefix;
3rd generates submodule, when type for the attribute when described global object is object type, judge whether the address of the property value of described attribute is present in described mapping table, when it is present, according to described reference list, described property value sequence is turned to the index information of described reference list, the title according to described index information and described attribute generates preset format object; When not existing, according to described property value, described attribute is converted to the attribute of preset format object, for the setup of attribute unique identification of described preset format object, and the attribute of described unique identification and described preset format object is added in described reference list, and according to described reference list, described property value sequence being turned to the index information of described reference list, the title according to described index information and described attribute generates preset format object.
8. device as claimed in claim 6, it is characterized in that, described preset format is JSON form.
9. device as claimed in claim 7 or 8, it is characterized in that, said apparatus also comprises:
Read module, for reading the preset format file of described webpage, obtains described preset format object;
Second generation module, for according to described preset format object, unserializing rule, described mapping table and described reference list, generates global object;
First creation module, for creating JS environment according to described global object;
Second creation module, for utilizing described JS creating environments node tree.
10. device as claimed in claim 9, it is characterized in that, described second generation module comprises:
4th generates submodule, when property value for the attribute when described preset format object is numerical value, null value, Boolean, array or the character string not with prefix, described property value is converted to JS value, according to title and the attribute value generation global object being converted to JS value of described attribute;
5th generates submodule, when the property value for the attribute when described preset format object is the character string of band preset function prefix, this character string is converted to JS function as function body, according to title and the described JS function generation global object of described attribute;
6th generates submodule, when the property value for the attribute when described preset format object is the character string being with described reference list index information prefix, using this character string as unique identification, judges whether this character string is present in described mapping table; When it is present, obtain the property value address of described attribute according to described mapping table, obtain the attribute of preset format object corresponding to this character string according to described reference list, generate global object according to the property value address of described attribute and the title of described attribute; When not existing, create the attribute of a global object, the attribute of preset format object corresponding to this character string is searched in described reference list, the attribute of preset format object corresponding according to this character string and the attribute of the global object of described establishment, this character string and property value address corresponding to this character string are added in mapping table, and generates global object according to the title of this attribute and property value address.
11. 1 kinds of devices preserving webpage, is characterized in that, comprising:
Processor;
For the storer of storage of processor executable instruction;
Wherein, described processor is configured to:
Obtain the JS environment that the node tree of webpage is corresponding, and obtain the environmentally hazardous global object of described JS;
According to described global object, serializing rule, the reference list preset and default mapping table, generate preset format object, wherein, described reference list comprises attribute and the uniquely identified corresponding relation of described preset format object, and described mapping table comprises the corresponding relation of described unique identification and property value address;
By described reference list and described preset format object merging, generate the preset format file of described webpage.
CN201410422472.6A 2014-08-25 2014-08-25 Webpage saving method and device Active CN105468606B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201410422472.6A CN105468606B (en) 2014-08-25 2014-08-25 Webpage saving method and device

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201410422472.6A CN105468606B (en) 2014-08-25 2014-08-25 Webpage saving method and device

Publications (2)

Publication Number Publication Date
CN105468606A true CN105468606A (en) 2016-04-06
CN105468606B CN105468606B (en) 2020-02-04

Family

ID=55606317

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201410422472.6A Active CN105468606B (en) 2014-08-25 2014-08-25 Webpage saving method and device

Country Status (1)

Country Link
CN (1) CN105468606B (en)

Cited By (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN106775696A (en) * 2016-12-08 2017-05-31 蓝信工场(北京)科技有限公司 Data processing method and device
CN110764768A (en) * 2018-07-26 2020-02-07 北京京东金融科技控股有限公司 Method and device for mutual conversion between model object and JSON object
CN112527444A (en) * 2020-12-29 2021-03-19 天翼阅读文化传播有限公司 User-defined page implementation method applied to virtual reality client user interface
CN116127936A (en) * 2023-04-04 2023-05-16 深圳市城市交通规划设计研究中心股份有限公司 Method for compiling engineering unit matrix diagram, electronic equipment and storage medium

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20110119652A1 (en) * 2009-11-16 2011-05-19 Limin Yu Generating object annotations
CN103514179A (en) * 2012-06-21 2014-01-15 腾讯科技(深圳)有限公司 Method for web browser to switch over historical webpages and web browser
CN103605518A (en) * 2013-11-19 2014-02-26 北京国双科技有限公司 Object deserialization method and device
CN103970855A (en) * 2014-05-06 2014-08-06 车智互联(北京)科技有限公司 Device and method for processing data

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20110119652A1 (en) * 2009-11-16 2011-05-19 Limin Yu Generating object annotations
CN103514179A (en) * 2012-06-21 2014-01-15 腾讯科技(深圳)有限公司 Method for web browser to switch over historical webpages and web browser
CN103605518A (en) * 2013-11-19 2014-02-26 北京国双科技有限公司 Object deserialization method and device
CN103970855A (en) * 2014-05-06 2014-08-06 车智互联(北京)科技有限公司 Device and method for processing data

Cited By (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN106775696A (en) * 2016-12-08 2017-05-31 蓝信工场(北京)科技有限公司 Data processing method and device
CN110764768A (en) * 2018-07-26 2020-02-07 北京京东金融科技控股有限公司 Method and device for mutual conversion between model object and JSON object
CN112527444A (en) * 2020-12-29 2021-03-19 天翼阅读文化传播有限公司 User-defined page implementation method applied to virtual reality client user interface
CN116127936A (en) * 2023-04-04 2023-05-16 深圳市城市交通规划设计研究中心股份有限公司 Method for compiling engineering unit matrix diagram, electronic equipment and storage medium

Also Published As

Publication number Publication date
CN105468606B (en) 2020-02-04

Similar Documents

Publication Publication Date Title
JP6227766B2 (en) Method, apparatus and terminal device for changing facial expression symbol in chat interface
CN104869569A (en) Network permission control method and apparatus of application program
CN105095427A (en) Search recommendation method and device
CN105183513A (en) Application recommendation method and apparatus
CN105263196A (en) Connection state prompting method and device
CN104636106A (en) Picture displaying method and device and terminal device
CN104038536A (en) Plug-in communication method and device
CN104536935A (en) Calculation displaying method, calculation editing method and device
CN105354017A (en) Information processing method and apparatus
CN105159524A (en) Interface display method and apparatus
CN104484438A (en) Image processing method and device
CN104281703A (en) Method and device for calculating similarity among uniform resource locators (URL)
CN104636164A (en) Generating method and device for starting page
CN105389113A (en) Gesture-based application control method and apparatus and terminal
CN104991910A (en) Album creation method and apparatus
CN104837178A (en) Network accessing method and device
CN104536787A (en) Resource preloading method and device
CN104881304A (en) Resource downloading method and device
CN105468606A (en) Webpage saving method and device
CN104935613A (en) Scene synchronization method, terminal, server and system
CN105488829A (en) Method and device for generating head portrait
CN105183571A (en) Function calling method and device
CN104636064A (en) Gesture generating method and device
CN104572848A (en) Search method and search device based on browser
CN105808304A (en) Code deployment method, device and system

Legal Events

Date Code Title Description
C06 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