WO2015043383A1 - 一种进行网页加载的方法、装置和浏览器 - Google Patents

一种进行网页加载的方法、装置和浏览器 Download PDF

Info

Publication number
WO2015043383A1
WO2015043383A1 PCT/CN2014/086428 CN2014086428W WO2015043383A1 WO 2015043383 A1 WO2015043383 A1 WO 2015043383A1 CN 2014086428 W CN2014086428 W CN 2014086428W WO 2015043383 A1 WO2015043383 A1 WO 2015043383A1
Authority
WO
WIPO (PCT)
Prior art keywords
webpage
kernel
browser
resource
current
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.)
Ceased
Application number
PCT/CN2014/086428
Other languages
English (en)
French (fr)
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 Qihoo Technology Co Ltd
Qizhi Software Beijing Co Ltd
Original Assignee
Beijing Qihoo Technology Co Ltd
Qizhi Software Beijing Co Ltd
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 Beijing Qihoo Technology Co Ltd, Qizhi Software Beijing Co Ltd filed Critical Beijing Qihoo Technology Co Ltd
Priority to US15/025,219 priority Critical patent/US20160232252A1/en
Publication of WO2015043383A1 publication Critical patent/WO2015043383A1/zh
Anticipated expiration legal-status Critical
Ceased legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING OR CALCULATING; COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/90Details of database functions independent of the retrieved data types
    • G06F16/95Retrieval from the web
    • G06F16/955Retrieval from the web using information identifiers, e.g. uniform resource locators [URL]
    • G06F16/9566URL specific, e.g. using aliases, detecting broken or misspelled links
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L67/00Network arrangements or protocols for supporting network services or applications
    • H04L67/01Protocols
    • H04L67/02Protocols based on web technology, e.g. hypertext transfer protocol [HTTP]
    • GPHYSICS
    • G06COMPUTING OR CALCULATING; COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/90Details of database functions independent of the retrieved data types
    • G06F16/95Retrieval from the web
    • G06F16/951Indexing; Web crawling techniques
    • GPHYSICS
    • G06COMPUTING OR CALCULATING; COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/90Details of database functions independent of the retrieved data types
    • G06F16/95Retrieval from the web
    • G06F16/957Browsing optimisation, e.g. caching or content distillation
    • GPHYSICS
    • G06COMPUTING OR CALCULATING; COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/90Details of database functions independent of the retrieved data types
    • G06F16/95Retrieval from the web
    • G06F16/957Browsing optimisation, e.g. caching or content distillation
    • G06F16/9574Browsing optimisation, e.g. caching or content distillation of access to content, e.g. by caching
    • GPHYSICS
    • G06COMPUTING OR CALCULATING; COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/90Details of database functions independent of the retrieved data types
    • G06F16/95Retrieval from the web
    • G06F16/958Organisation or management of web site content, e.g. publishing, maintaining pages or automatic linking
    • GPHYSICS
    • G06COMPUTING OR CALCULATING; COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/44Arrangements for executing specific programs
    • GPHYSICS
    • G06COMPUTING OR CALCULATING; COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/44Arrangements for executing specific programs
    • G06F9/445Program loading or initiating
    • G06F9/44521Dynamic linking or loading; Link editing at or after load time, e.g. Java class loading
    • G06F9/44526Plug-ins; Add-ons
    • GPHYSICS
    • G06COMPUTING OR CALCULATING; COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/44Arrangements for executing specific programs
    • G06F9/455Emulation; Interpretation; Software simulation, e.g. virtualisation or emulation of application or operating system execution engines
    • G06F9/45504Abstract machines for programme code execution, e.g. Java virtual machine [JVM], interpreters, emulators
    • G06F9/45529Embedded in an application, e.g. JavaScript in a Web browser
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L69/00Network arrangements, protocols or services independent of the application payload and not provided for in the other groups of this subclass
    • H04L69/12Protocol engines

Definitions

  • the present invention relates to the technical field of browsers, and in particular, to a method for loading a web page, a device for loading a web page, and a browser.
  • the browser can be divided into two parts, the kernel and the shell.
  • the browser kernel is the core part of the browser and can be divided into two parts: the rendering engine (layout engineer or rendering engine) and the JS (JavaScript) engine.
  • the rendering engine is mainly responsible for obtaining the content of the webpage (including HTML, XML, images, etc.), organizing information (such as adding CSS (Cascading Style Sheets), etc.), and calculating how the webpage is displayed, and then outputting it to the display or printer. .
  • the difference in the browser kernel is different for the syntax of the web page, so the rendering effect is different. All web browsers, email clients, and other applications that need to edit and display web content require a kernel.
  • the JS engine parses the Javascript language and executes the Javascript language to implement the dynamic effects of the web page.
  • browser kernels There are many types of browser kernels. The more common browser kernels are the Trident kernel used by Microsoft's Internet Explorer, the Gecko kernel used by Firefox, the Safari browser of Apple, and the Webkit kernel used by Google's Chrome browser. And the Presto kernel used by the Opera browser.
  • the browser downloads the content of the webpage from the target website through the kernel, then analyzes the webpage content, executes the script, calculates the typesetting, and finally outputs the display to the display to the user.
  • Each browser has a kernel, and the browser uses the same kernel to interpret the execution regardless of how many pages the user opens through a browser process.
  • this single-core browser has a lot of limitations, because web pages are often made according to the network standards supported by a certain kernel. For the network standards supported by a particular kernel, other kernels may not be well supported (even Unable to support). For example, if a user browses a webpage using the Firefox browser, the kernel of the Firefox browser can well support the W3C standard, so Use this browser to browse web pages made in accordance with W3C standards. However, if users want to browse the China Merchants Bank website using Internet Banking, the Firefox browser will not be able to meet this user's needs. Because the online banking function of the China Merchants Bank website requires the ActiveX plug-in function, and this function may only be supported by the IE kernel, users can not use the online banking function of China Merchants Bank when using the Firefox browser.
  • the present invention has been made in order to provide a method for performing web page loading and a corresponding apparatus for performing web page loading, and a browser, which overcomes the above problems or at least partially solves the above problems.
  • a method for performing web page loading including:
  • the first browser core Receiving, by the first browser core, a first loading request of the current webpage on the browser side; the first loading request includes a URL of the current webpage;
  • the first webpage resource is a webpage resource required to load the current webpage
  • the second webpage resource is the remaining webpage resources required by the first browser kernel to be loaded from the server side, except for the first webpage resource, for loading the current webpage.
  • an apparatus for performing web page loading including:
  • a first loading request receiving module configured to receive, by using a first browser kernel, a first loading request of a current webpage on a browser side; the first loading request includes a URL of a current webpage;
  • the first webpage resource obtaining module is configured to start acquiring and caching the first webpage resource according to the first loading request;
  • the first webpage resource is a webpage resource required for loading the current webpage;
  • a browser kernel matching module configured to search for a browser matching the current webpage according to the URL Kernel
  • a second browser kernel startup module configured to start the second browser kernel when the browser kernel matched by the current webpage is the second browser kernel
  • a webpage loading module configured to perform loading of the current webpage by using the first webpage resource and the second webpage resource transmitted by the first browser kernel by using the second browser kernel;
  • the second webpage resource is the remaining webpage resources required by the first browser kernel to be loaded from the server side, except for the first webpage resource, for loading the current webpage.
  • a browser comprising:
  • a first loading request receiving module configured to receive, by using a first browser kernel, a first loading request of a current webpage on a browser side; the first loading request includes a URL of a current webpage;
  • the first webpage resource obtaining module is configured to start acquiring and caching the first webpage resource according to the first loading request;
  • the first webpage resource is a webpage resource required for loading the current webpage;
  • a browser kernel matching module configured to search for a browser kernel matching the current webpage according to the URL
  • a second browser kernel startup module configured to start the second browser kernel when the browser kernel matched by the current webpage is the second browser kernel
  • a webpage loading module configured to perform loading of the current webpage by using the first webpage resource and the second webpage resource transmitted by the first browser kernel by using the second browser kernel;
  • the second webpage resource is the remaining webpage resources required by the first browser kernel to be loaded from the server side, except for the first webpage resource, for loading the current webpage.
  • a computer program comprising computer readable code, when the computer readable code is run on an electronic device, causing the electronic device to perform the method of performing web page loading .
  • a computer readable medium wherein the computer program is stored.
  • the second browser kernel when it is determined that the current webpage is suitable to be loaded by the second browser kernel, the second browser kernel is started, and the browser kernel is switched, when the original browser kernel is requested.
  • the obtained cached webpage resources are reused, and the webpage resources that are not cached are requested to be obtained, and then all the webpage resources obtained are sent to the second browser kernel through the IPC for rendering loading, thereby avoiding repeated acquisition of the webpage resources. , improve the loading speed of the webpage.
  • the browser kernel is determined, and the resource mapping table is used to find the JavaScript resource corresponding to the current webpage URL, and the plugin object corresponding to the JavaScript resource is searched through the plugin mapping table, and finally determined.
  • the browser kernel is equipped to improve the adaptability of loading webpages by using the browser kernel, and the efficiency of loading webpages is improved.
  • FIG. 1 is a flow chart showing the steps of Embodiment 1 of a method for performing webpage loading according to an embodiment of the present invention
  • FIG. 2 is a flow chart showing the steps of Embodiment 2 of a method for performing webpage loading according to an embodiment of the present invention
  • FIG. 3 is a schematic block diagram showing an embodiment of an apparatus for performing webpage loading according to an embodiment of the present invention
  • Figure 4 schematically shows a block diagram of an electronic device for performing the method according to the invention
  • Fig. 5 schematically shows a storage unit for holding or carrying program code implementing the method according to the invention.
  • Embodiment 1 is a flow chart showing the steps of Embodiment 1 of a method for performing webpage loading according to an embodiment of the present invention, which may specifically include the following steps:
  • Step 101 Receive a first loading request of the current webpage by using a first browser kernel on the browser side; the first loading request includes a URL of the current webpage;
  • Step 102 Start acquiring and caching a first webpage resource according to the first loading request;
  • the first webpage resource is a webpage resource required to load a current webpage;
  • Step 103 Search for a browser kernel matching the current webpage according to the URL;
  • Step 104 When the browser kernel that matches the current webpage is the second browser kernel, start the second browser kernel.
  • Step 105 Perform loading of the current webpage by using the first webpage resource and the second webpage resource transmitted by the first browser kernel by using the second browser kernel;
  • the second webpage resource is the remaining webpage resources required by the first browser kernel to be loaded from the server side, except for the first webpage resource, for loading the current webpage.
  • the second browser kernel when it is determined that the current webpage is suitable to be loaded by the second browser kernel, the second browser kernel is started, and the browser kernel is switched, and the cached webpage resources acquired when the original browser kernel makes a request are repeated. Use and request to obtain the un-cached webpage resources, and then send all the obtained webpage resources to the second browser kernel through the IPC for rendering loading, thereby avoiding repeated acquisition of webpage resources and improving the loading speed of the webpage.
  • Embodiment 2 of a method for performing webpage loading according to an embodiment of the present invention is shown, which may specifically include the following steps:
  • Step 201 Receive a first loading request of the current webpage by using a first browser kernel on the browser side; the first loading request includes a URL of the current webpage;
  • the browser may include two or more browser kernels, and the first browser kernel may be a browser kernel currently used by the browser by default, and the default browser kernel may be set by the system, Can be set by the user, specifically a high-performance browser kernel such as the Webkit kernel. Of course, it can also be the Gecko kernel, the Presto kernel, etc. The embodiment of the present invention does not limit this.
  • the first loading request of the current webpage may refer to an instruction sent by the user to load a webpage.
  • a user can open a web page by clicking on a link, or enter a web address in the address bar to open a web page, and the like.
  • the user clicks the instruction of a link it is equivalent to receiving the loading request of the user loading the webpage; similarly, when a certain web address is input in the address bar and the OK button is clicked or the enter key is pressed, the user loads the webpage. Load request.
  • the content of the loading request may include an identifier of a webpage requested by the user and/or a feature of the webpage.
  • the webpage identifier may be information that can represent a uniquely determined webpage, such as a Uniform Resource Identifier (URI), and the uniform resource identifier may specifically include a Uniform Resource Locator (URL), or a unified resource. Name (Uniform Resource Name, URN) and so on.
  • URI Uniform Resource Identifier
  • URL Uniform Resource Locator
  • URN Uniform Resource Name
  • the first browser kernel may include a first kernel process and a second kernel process.
  • a kernel process can be a unit of browser execution and allocation of resources.
  • step 201 may specifically include the following sub-steps:
  • Sub-step S11 receiving, by the first kernel process, a first loading request of the current webpage on the browser side.
  • the first kernel process may obtain the URL of the current webpage, and may also obtain the URI of the current webpage and/or the webpage identifier of the URN, which is not limited in this embodiment of the present invention.
  • Step 202 Start acquiring and caching a first webpage resource according to the first loading request;
  • the first webpage resource is a webpage resource required to load a current webpage;
  • the normal webpage loading can be performed by the first kernel process.
  • step 202 may specifically include the following sub-steps:
  • Sub-step S21 using the first kernel process to access the URL to start acquiring and buffering plus The resources required to load the current web page.
  • the first web process can be directly loaded by the first kernel process to load the current web page.
  • the current webpage can also be loaded by using a webpage identifier such as a URI and/or a URN.
  • the process of loading a webpage can be as follows:
  • the browser When detecting the user input URL (assuming an HTML page, and is the first visit), the browser sends a request to the server to load the webpage indicated by the web address, and the server returns the corresponding HTML text;
  • the browser starts loading the source code of the HTML text.
  • it detects that there is a ⁇ link> tag in the ⁇ head> tag it needs to reference the external CSS file.
  • the browser sends a request for a CSS file to the server, and the server returns a corresponding CSS file;
  • the browser continues to load the code in the ⁇ body> section of the HTML text. At this point the CSS file has been received and the web page can be rendered.
  • the browser detects an ⁇ img> tag in the HTML text, it needs to reference a picture, and then sends a request to load the image to the server. At this point, the browser does not wait for the image to be downloaded, but continues to render the following code;
  • the server returns the image file. Since the image occupies a certain area, it affects the arrangement of the following paragraphs, so the browser needs to re-render this part of the code;
  • JavaScript causes the browser to change the CSS path of the ⁇ link> tag
  • the browser uses various elements such as ⁇ div>, ⁇ span>, ⁇ ul>, ⁇ li>, and The server requests a new CSS file and re-renders the page.
  • Step 203 Search for a browser kernel matching the current webpage according to the URL;
  • One of the methods can learn the adaptation relationship between the webpage requested by the user and the browser kernel according to the content obtained from the request information and the preset rule.
  • the preset rule may include a specific adaptation rule, a universal adaptation rule, and/or a non-adaptation rule, and may be based on a specific adaptation rule, a universal adaptation rule, and/or an inappropriate process in requesting loading of a webpage. Match the rules to know the adaptation relationship between the web page requested by the user and the browser kernel.
  • the specific adaptation rule may include an adaptation relationship between the webpage and the kernel.
  • the universal adaptation rule may include selecting a browser kernel with the fastest average loading speed for the user or selecting a browser kernel that supports the network standard for the user.
  • the non-adaptive rule may include an unsuitable relationship between the web page and the kernel.
  • the server Since the browser also sends the loading request information about loading the webpage to the corresponding server according to the received loading request, the server returns a response information for the loading request information, and the response information carries information such as the page content of the webpage, so In this case, it is also possible to re-learn the browser kernel adapted to the webpage requested by the user according to the content obtained from the response information of the loading request information returned from the server and the preset rule; if the re-obtained adapted browser The kernel differs from the previously adapted browser kernel learned based on the request information, and then selects the re-acquired adaptation browser kernel to load the web page requested by the user.
  • the server since the browser further sends the loading request information about loading the webpage to the corresponding server according to the received loading request, the server returns a response message for the loading request information, and the webpage of the webpage is carried in the response information.
  • Information such as content, so in the method, the content obtained by the response information returned by the server and the preset rule can be directly used to know the adaptation relationship between the web page requested by the user and the browser kernel.
  • the matching relationship between the webpage requested by the user and the browser kernel may be jointly learned according to the content obtained from the loading request, the content obtained from the response information returned by the server for the loading request information, and the preset rule.
  • the loading of the webpage requested by the user may be detected; if the phenomenon that the preset kernel switching condition is met occurs, the webpage is re-known according to the preset rule.
  • the browser kernel is configured; the re-obtained adapted browser kernel is loaded to load the web page requested by the user.
  • the phenomenon that the preset kernel switching condition is met may include: detecting that the loading speed is slow during the loading process, or detecting that the webpage is not displayed normally after the loading is completed, and the like.
  • the step 203 may specifically include the following sub-steps:
  • Sub-step S31 searching for a JavaScript resource corresponding to the URL in a preset resource mapping table.
  • Sub-step S32 searching for a plug-in object corresponding to the JavaScript resource in a preset plug-in mapping table
  • Sub-step S33 determining that the plug-in object is suitable for running a browser kernel is a browser kernel that matches the current webpage.
  • the page resources required to load a web page may include resources such as JavaScript, css, images, and/or font files in the HTML page.
  • Page resources such as JavaScript, css, images, and/or font files can be used for rendering of the page.
  • JavaScript is a scripting language.
  • the source code does not need to be compiled before being sent to the client. Instead, the text code is sent to the browser and interpreted by the browser.
  • the weakness of the interpreted language is that it is less secure, and in JavaScript, if one doesn't work, the following languages won't work. And because each reload will be re-interpreted, after loading, some code will be delayed until runtime to interpret, and even multiple interpretations, so the page load is slower.
  • the browser kernel adapted by JavaScript can be called to load the current web page. For example, each browser may load webpages on average.
  • the Presto kernel requires only about 1/3 of the Trident and Gecko kernels to execute the equivalent JavaScript.
  • the resource mapping table may be preset in the browser or the server, and the resource mapping table may record that different web pages are loaded (specifically, the webpages may be identified by using URLs, and different webpages may be identified by using URIs and/or URNs)
  • the corresponding page resource may specifically include JavaScript.
  • the plug-in object can be recorded in the browser or server preset plug-in mapping table, and the plug-in mapping table can record the plug-in object corresponding to different JavaScript.
  • the first browser kernel is used to obtain a webpage resource request, and the webpage resource data is returned to the browser side cache, such as HTML text, a picture, a video element, and embedded therein, for example, or Plug-in object, this data will be displayed by the browser after the page is loaded.
  • the browser kernel mapping table can record the browser kernel to which different plugin objects are loaded.
  • the plug-in object in the webpage resource can be monitored and loaded during initialization: for the ⁇ embed> element in the webpage, where the CLSID refers to the system for different applications, file types, OLE objects, special folders. And the various system components are assigned a unique representation of the ID code) that is recognized as part of the web page resource, and the CLSID is the unique identifier of the web page plugin object. For matching to the specified plugin object, switch to the corresponding browser kernel to use the browser kernel to re-render and load the web page.
  • the preset resource mapping table it is found that clicking a file to download under the current webpage needs to activate a JavaScript script, and the JavaScript script correspondingly starts a downloading tool, and the downloading tool is more suitable for running under the browser of the Trident kernel. Knowing the adaptation relationship is that the current web page is suitable for loading with the Trident kernel.
  • one, two or three of the resource mapping table, the plug-in mapping table, and the browser kernel mapping table may be combined in the same mapping table.
  • the corresponding search can be performed locally.
  • the server presets the resource mapping table, the plug-in mapping table, and/or the browser kernel mapping table, the corresponding lookup request may be sent, and the information returned by the server may be received.
  • Step 204 When the browser kernel that matches the current webpage is the second browser kernel, start the second browser kernel.
  • the second browser kernel can be a browser built-in browser kernel other than the first browser kernel, and can adapt the loading of the current webpage in some cases, which can be a Trident kernel (ie, an IE kernel). Includes IE-com kernel (compatible IE kernel) and / or IE-stand kernel. Of course, it can also be a Gecko kernel, a Presto kernel, etc., which is not limited by the embodiment of the present invention.
  • the loading of the current webpage can be directly performed by using the first browser kernel.
  • the second browser kernel may include a third kernel process. It should be noted that a browser can run one or more kernel processes, not just the first kernel process, the second kernel process, and the third kernel process.
  • step 204 may specifically include the following sub-steps:
  • Sub-step S41 suspending the first kernel process to acquire and cache the resources required to load the current webpage
  • Sub-step S42 starting the third kernel process
  • Sub-step S43 the first kernel process is used to transmit the URL of the current webpage to the third kernel process.
  • the current browser kernel (ie, the first browser kernel) is stopped to load the current web page.
  • the web resource currently loaded by the first kernel process may be referred to as a first web resource. It should be noted that when the knowledge relationship between the webpage requested by the user and the browser kernel is known, when the first kernel process is suspended, the resources required for loading the current webpage are acquired and cached.
  • the first kernel process may pass the current webpage URL to the third kernel process, and may also transfer the URI of the current webpage and/or the webpage identifier such as the URN to the third kernel process, which is not limited by the embodiment of the present invention.
  • Step 205 When the second browser kernel is requested to load the current webpage, the first browser kernel is used to generate a second loading request of the current webpage.
  • a new browser navigation can be initiated by the second browsing kernel using the URL of the current web page.
  • the step 205 may specifically include the following sub-steps:
  • Sub-step S51 calling the network programming interface WinInet to start the management session class CInternetSession;
  • Sub-step S52 When the request of the second kernel process to load a webpage is monitored in the management session class CInternetSession, the URL in the request is extracted;
  • Sub-step S53 determining whether the URL in the request is the same as the URL of the current webpage; if yes, transmitting the URL of the current webpage to the second kernel process;
  • Sub-step S54 The second kernel process is used to generate a second loading request of the current webpage for the URL of the current webpage.
  • WinInet which is a Windows Internet extension application programming interface, is provided for the development of Internet-enabled client applications, can support HTTP protocol, FTP protocol and In the GOPHER protocol, a CinternetSession object can be used to identify each HTTP request or HTTPS request, and then identify the URL of the HTTP request or HTTPS request. If it is determined that the URL is the URL of the current webpage, the IPC (Inter-Process Communication, which refers to some techniques or methods for transmitting data or signals between at least two processes or threads) according to the URL of the current webpage, will be the third kernel. The URL in the process is passed to the third kernel process. In the third kernel process, an HTTP request based on the first browser kernel is performed according to the URL.
  • IPC Inter-Process Communication
  • Step 206 Acquire the first browser kernel according to the second loading request. a web page resource
  • the first webpage resource is a webpage resource that is acquired and cached by the first browser kernel for the first loading request;
  • the first webpage resource is stored in the local cache. To avoid repeatedly requesting webpage resources and further speeding up the request of the webpage resource, the first webpage resource can be directly used to load the current webpage.
  • the step 206 may specifically include the following sub-steps:
  • Sub-step S51 extracting a URL of the current webpage in the second loading request
  • Sub-step S52 determining whether there is a webpage resource corresponding to the URL in the browser cache; if yes, using the second kernel process to extract the webpage resource corresponding to the URL.
  • the first browser kernel will query the resource in the local cache before requesting the webpage resource from the server corresponding to the URL. If there is a resource corresponding to the URL that has been downloaded, the server will not be requested again. Instead, use the already cached resource directly.
  • Step 207 Acquire a second webpage resource from the server side by using the first browser kernel.
  • the second webpage resource is the remaining webpage resources required by the first browser kernel to be loaded from the server side, except for the first webpage resource, for loading the current webpage.
  • the first webpage resource acquired by the first kernel process may not be all the webpage resources required to load the current webpage, and the remaining required for loading the current webpage.
  • the step 207 may specifically include the following sub-steps:
  • Sub-step S71 in the second kernel process, setting the user agent UserAgent to indicate the identity of the second browser kernel;
  • Sub-step S72 requesting to load the current webpage by accessing the URL of the current webpage to the server side; the request includes an identifier of the second webpage resource; and the server is configured to extract the second webpage Page resource
  • Sub-step S73 receiving the second webpage resource returned by the server side.
  • a request based on the first browser kernel architecture may be generated to request a webpage resource that has not been downloaded yet.
  • different markups may be used to mark the two webpage resources separately.
  • the parameter of the user agent UserAgent in the request based on the first browser kernel architecture is an identifier that needs to be set to indicate the second browser kernel.
  • the obtained second web resource may also be stored in a local cache.
  • Step 208 The first browser kernel is used to transmit the first webpage resource and the second webpage resource to the second browser kernel to load the current webpage.
  • the first webpage resource and the second webpage resource may be all resources required for loading the current webpage.
  • the second webpage kernel may be used to perform the current webpage. Rendering.
  • the step 208 may specifically include the following sub-steps:
  • Sub-step S81 the first webpage resource and the second webpage resource are respectively transmitted to the third kernel process by using an inter-process communication IPC in the second kernel process;
  • Sub-step S82 the third kernel process is used to render the current webpage by using the first webpage resource and the second webpage resource.
  • the cached webpage resources (the first webpage resource and the second webpage resource) are transmitted to the third kernel process by using IPC communication, and the read function of the second browser kernel acquires the cached webpage resource, and performs Subsequent rendering and display.
  • the second browser kernel when it is determined that the current webpage is suitable to be loaded by the second browser kernel, the second browser kernel is started, and the browser kernel is switched, and the cached webpage resources acquired when the original browser kernel makes a request are repeated. Use and request to obtain the un-cached webpage resources, and then send all the obtained webpage resources to the second browser kernel through the IPC for rendering loading, thereby avoiding repeated acquisition of webpage resources and improving the loading speed of the webpage.
  • the browser kernel is determined, and the resource mapping table is used to find the JavaScript resource corresponding to the current webpage URL, and the plugin object corresponding to the JavaScript resource is searched through the plugin mapping table, and finally determined.
  • the browser kernel is equipped to improve the adaptability of loading webpages by using the browser kernel, and the efficiency of loading webpages is improved.
  • FIG. 3 a structural block diagram of an apparatus for performing webpage loading according to an embodiment of the present invention is shown. Specifically, the following modules may be included:
  • the first load request receiving module 301 is adapted to receive, by the first browser core, a first loading request of the current webpage on the browser side; the first loading request includes a URL of the current webpage;
  • the first webpage resource obtaining module 302 is adapted to start acquiring and caching the first webpage resource according to the first loading request; the first webpage resource is a webpage resource required for loading the current webpage;
  • the browser kernel matching module 303 is adapted to search, according to the URL, a browser kernel that matches a current webpage;
  • the second browser kernel startup module 304 is configured to start the second browser kernel when the browser kernel matched by the current webpage is the second browser kernel;
  • the webpage loading module 305 is adapted to perform loading of the current webpage by using the first webpage resource and the second webpage resource transmitted by the first browser kernel by using the second browser kernel;
  • the second webpage resource is the remaining webpage resources required by the first browser kernel to be loaded from the server side, except for the first webpage resource, for loading the current webpage.
  • the webpage loading module is further adapted to:
  • the first browser kernel is used to generate a second loading request of the current webpage
  • the first browser kernel includes a first kernel
  • the second browser kernel includes a third kernel process.
  • the first load request receiving module is further adapted to:
  • the first webpage resource obtaining module is further adapted to:
  • the first kernel process is used to access the URL to start acquiring and caching resources required to load the current web page.
  • the browser kernel matching module is further adapted to:
  • the plug-in object is suitable for running a browser kernel that is a browser kernel that matches the current web page.
  • the second browser kernel startup module is further adapted to:
  • the first kernel process is used to transmit the URL of the current web page to the third kernel process.
  • the webpage loading module is further adapted to:
  • the second kernel process is used to generate a second loading request of the current webpage for the URL of the current webpage.
  • the webpage loading module is further adapted to:
  • the second kernel process extracts webpage resources corresponding to the URL.
  • the webpage loading module is further adapted to:
  • the server is requested to load the current webpage by accessing the URL of the current webpage; the request includes an identifier of the second webpage resource; and the server is configured to extract the second webpage resource;
  • the webpage loading module is further adapted to:
  • the description is relatively simple, and the relevant parts can be referred to the description of the method embodiment.
  • the present invention also provides a browser, which may specifically include the following modules:
  • a first loading request receiving module configured to receive, by using a first browser kernel, a first loading request of a current webpage on a browser side; the first loading request includes a URL of a current webpage;
  • the first webpage resource obtaining module is configured to start acquiring and caching the first webpage resource according to the first loading request;
  • the first webpage resource is a webpage resource required for loading the current webpage;
  • a browser kernel matching module configured to search for a browser kernel matching the current webpage according to the URL
  • a second browser kernel startup module configured to start the second browser kernel when the browser kernel matched by the current webpage is the second browser kernel
  • a webpage loading module configured to perform loading of the current webpage by using the first webpage resource and the second webpage resource transmitted by the first browser kernel by using the second browser kernel;
  • the second webpage resource is the remaining webpage resources required by the first browser kernel to be loaded from the server side, except for the first webpage resource, for loading the current webpage.
  • the webpage loading module is further adapted to:
  • the first browser kernel is used to generate a second loading request of the current webpage
  • the first browser kernel includes a first kernel process and a second kernel process
  • the second browser kernel includes a third kernel process
  • the first load request receiving module is further adapted to:
  • the first webpage resource obtaining module is further adapted to:
  • the first kernel process is used to access the URL to start acquiring and caching resources required to load the current web page.
  • the browser kernel matching module is further adapted to:
  • the plug-in object is suitable for running a browser kernel that is a browser kernel that matches the current web page.
  • the second browser kernel startup module is further adapted to:
  • the first kernel process is used to transmit the URL of the current web page to the third kernel process.
  • the webpage loading module is further adapted to:
  • the second kernel process is used to generate a second loading request of the current webpage for the URL of the current webpage.
  • the webpage loading module is further adapted to:
  • the webpage loading module is further adapted to:
  • the server is requested to load the current webpage by accessing the URL of the current webpage; the request includes an identifier of the second webpage resource; and the server is configured to extract the second webpage resource;
  • the webpage loading module is further adapted to:
  • the various component embodiments of the present invention may be implemented in hardware, or in a software module running on one or more processors, or in a combination thereof.
  • a microprocessor or digital signal processor may be used in practice to implement some or all of the functionality of some or all of the components of the web page loading device in accordance with embodiments of the present invention.
  • the invention can also be implemented as a device or device program (e.g., a computer program and a computer program product) for performing some or all of the methods described herein.
  • a program implementing the invention may be stored on a computer readable medium or may be in the form of one or more signals. Such signals can be downloaded from the Internet website, or Provided on the body signal, or in any other form.
  • FIG. 4 illustrates a server, such as a computer, mobile device, that can perform web page loading in accordance with the present invention.
  • the electronic device conventionally includes a processor 410 and a computer program product or computer readable medium in the form of a memory 420.
  • the memory 420 may be an electronic memory such as a flash memory, an EEPROM (Electrically Erasable Programmable Read Only Memory), an EPROM, a hard disk, or a ROM.
  • Memory 420 has a memory space 430 for program code 431 for performing any of the method steps described above.
  • storage space 430 for program code may include various program code 431 for implementing various steps in the above methods, respectively.
  • the program code can be read from or written to one or more computer program products.
  • These computer program products include program code carriers such as hard disks, compact disks (CDs), memory cards or floppy disks.
  • Such computer program products are typically portable or fixed storage units as described with reference to FIG.
  • the storage unit may have a storage section, a storage space, and the like arranged similarly to the storage 420 in the electronic device of FIG.
  • the program code can be compressed, for example, in an appropriate form.
  • the storage unit includes computer readable code 431', ie, code readable by a processor, such as 410, that when executed by an electronic device causes the electronic device to perform each of the methods described above step.

Landscapes

  • Engineering & Computer Science (AREA)
  • Software Systems (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Databases & Information Systems (AREA)
  • Data Mining & Analysis (AREA)
  • Computer Networks & Wireless Communication (AREA)
  • Signal Processing (AREA)
  • Information Transfer Between Computers (AREA)

Abstract

一种进行网页加载的方法,包括:在浏览器侧采用第一浏览器内核接收当前网页的第一加载请求;所述第一加载请求中包括当前网页的URL;依据所述第一加载请求开始获取并缓存第一网页资源;所述第一网页资源为加载当前网页所需的网页资源;依据所述URL查找当前网页匹配的浏览器内核;当所述当前网页匹配的浏览器内核为第二浏览器内核时,启动所述第二浏览器内核;采用所述第二浏览器内核基于所述第一浏览器内核传输的第一网页资源和第二网页资源,进行当前网页的加载;其中,所述第二网页资源为所述第一浏览器内核从服务器侧获取的,除所述第一网页资源外的加载当前网页所需的剩余网页资源。所述方法提高了网页的加载速度。

Description

一种进行网页加载的方法、装置和浏览器 技术领域
本发明涉及浏览器的技术领域,尤其涉及一种进行网页加载的方法、一种进行网页加载的装置和一种浏览器。
背景技术
浏览器从架构上可以分为两个部分,即内核和外壳。浏览器内核是指浏览器的核心部分,可以分成两部分:渲染引擎(layout engineer或者Rendering Engine)和JS(JavaScript)引擎。渲染引擎主要负责取得网页的内容(包括HTML、XML、图像等)、整理信息(如加入CSS(Cascading Style Sheets,层叠样式表单)等),以及计算网页的显示方式,然后会输出至显示器或打印机。浏览器内核的不同对于网页的语法解释会有不同,所以渲染的效果也不相同。所有网页浏览器、电子邮件客户端以及其它需要编辑、显示网络内容的应用程序都需要内核。JS引擎则是解析Javascript语言,执行Javascript语言来实现网页的动态效果。
浏览器内核的种类有很多,目前比较常见的浏览器内核有微软的IE浏览器使用的Trident内核,Firefox浏览器使用的Gecko内核,苹果的Safari浏览器和Google的Chrome浏览器使用的Webkit内核,以及,Opera浏览器采用的Presto内核。
当用户通过浏览器发起一个浏览网页的请求时,浏览器通过内核从目标网站下载网页的内容,然后分析网页内容,执行脚本,计算排版,最后输出到显示器显示给用户。每个浏览器具有一个内核,不管用户通过一个浏览器进程打开多少个网页,浏览器都使用同一个内核解释执行。
但是,这种单内核浏览器有很大的局限性,因为网页往往是按照某个内核支持的网络标准制作的,对于某个特定内核支持的网络标准,其他内核可能无法很好地支持(甚至无法支持)。例如,用户使用Firefox浏览器浏览网页,Firefox浏览器的内核能够很好地支持W3C标准,因此 使用该浏览器可以浏览按照W3C标准制作的网页。但如果用户想要浏览招商银行网页使用网络银行,Firefox浏览器就无法满足这个用户需求。因为招商银行网站的网络银行功能需要ActiveX插件功能,而该功能可能只有IE的内核才能支持,这样用户在使用Firefox浏览器的情况下就无法使用招商银行的网络银行功能了。
发明内容
鉴于上述问题,提出了本发明以便提供一种克服上述问题或者至少部分地解决上述问题的一种进行网页加载的方法和相应的一种进行网页加载的装置,以及一种浏览器。
根据本发明的一个方面,提供了一种进行网页加载的方法,包括:
在浏览器侧采用第一浏览器内核接收当前网页的第一加载请求;所述第一加载请求中包括当前网页的URL;
依据所述第一加载请求开始获取并缓存第一网页资源;所述第一网页资源为加载当前网页所需的网页资源;
依据所述URL查找当前网页匹配的浏览器内核;
当所述当前网页匹配的浏览器内核为第二浏览器内核时,启动所述第二浏览器内核;
采用所述第二浏览器内核基于所述第一浏览器内核传输的第一网页资源和第二网页资源,进行当前网页的加载;
其中,所述第二网页资源为所述第一浏览器内核从服务器侧获取的,除所述第一网页资源外的加载当前网页所需的剩余网页资源。
根据本发明的另一方面,提供了一种进行网页加载的装置,包括:
第一加载请求接收模块,适于在浏览器侧采用第一浏览器内核接收当前网页的第一加载请求;所述第一加载请求中包括当前网页的URL;
第一网页资源获取模块,适于依据所述第一加载请求开始获取并缓存第一网页资源;所述第一网页资源为加载当前网页所需的网页资源;
浏览器内核匹配模块,适于依据所述URL查找当前网页匹配的浏览器 内核;
第二浏览器内核启动模块,适于在所述当前网页匹配的浏览器内核为第二浏览器内核时,启动所述第二浏览器内核;
网页加载模块,适于采用所述第二浏览器内核基于所述第一浏览器内核传输的第一网页资源和第二网页资源,进行当前网页的加载;
其中,所述第二网页资源为所述第一浏览器内核从服务器侧获取的,除所述第一网页资源外的加载当前网页所需的剩余网页资源。
根据本发明的另一方面,提供了一种浏览器,包括:
第一加载请求接收模块,适于在浏览器侧采用第一浏览器内核接收当前网页的第一加载请求;所述第一加载请求中包括当前网页的URL;
第一网页资源获取模块,适于依据所述第一加载请求开始获取并缓存第一网页资源;所述第一网页资源为加载当前网页所需的网页资源;
浏览器内核匹配模块,适于依据所述URL查找当前网页匹配的浏览器内核;
第二浏览器内核启动模块,适于在所述当前网页匹配的浏览器内核为第二浏览器内核时,启动所述第二浏览器内核;
网页加载模块,适于采用所述第二浏览器内核基于所述第一浏览器内核传输的第一网页资源和第二网页资源,进行当前网页的加载;
其中,所述第二网页资源为所述第一浏览器内核从服务器侧获取的,除所述第一网页资源外的加载当前网页所需的剩余网页资源。
根据本发明的又一个方面,提供了一种计算机程序,其包括计算机可读代码,当所述计算机可读代码在电子设备上运行时,导致所述电子设备执行所述的进行网页加载的方法。
根据本发明的再一个方面,提供了一种计算机可读介质,其中存储了所述的计算机程序。
本发明的有益效果为:
本发明中,当判定当前网页适于采用第二浏览器内核加载时启动第二浏览器内核,进行浏览器内核的切换,对于原浏览器内核进行请求时 获取的已缓存的网页资源的进行重复使用,并请求获取到未进行缓存的网页资源,然后通过IPC将获取的全部网页资源发送到第二浏览器内核中进行渲染加载,避免了重复获取网页资源,提高了网页的加载速度。
本发明中,在网页进行渲染前进行适配浏览器内核的判断,通过使用了资源映射表查找当前网页URL对应的JavaScript资源,在通过插件映射表查找该JavaScript资源对应的插件对象,最后确定适配的浏览器内核,提高了采用浏览器内核加载网页的适配程度,提高了加载网页的效率。
上述说明仅是本发明技术方案的概述,为了能够更清楚了解本发明的技术手段,而可依照说明书的内容予以实施,并且为了让本发明的上述和其它目的、特征和优点能够更明显易懂,以下特举本发明的具体实施方式。
附图说明
通过阅读下文优选实施方式的详细描述,各种其他的优点和益处对于本领域普通技术人员将变得清楚明了。附图仅用于示出优选实施方式的目的,而并不认为是对本发明的限制。而且在整个附图中,用相同的参考符号表示相同的部件。在附图中:
图1示意性示出了根据本发明一个实施例的一种进行网页加载的方法实施例1的步骤流程图;
图2示意性示出了根据本发明一个实施例的一种进行网页加载的方法实施例2的步骤流程图;
图3示意性示出了根据本发明一个实施例的一种进行网页加载的装置实施例的结构框图;
图4示意性地示出了用于执行根据本发明的方法的电子设备的框图;以及
图5示意性地示出了用于保持或者携带实现根据本发明的方法的程序代码的存储单元。
具体实施方式
下面结合附图和具体的实施方式对本发明作进一步的描述。
参照图1,示出了根据本发明一个实施例的一种进行网页加载的方法实施例1的步骤流程图,具体可以包括以下步骤:
步骤101,在浏览器侧采用第一浏览器内核接收当前网页的第一加载请求;所述第一加载请求中包括当前网页的URL;
步骤102,依据所述第一加载请求开始获取并缓存第一网页资源;所述第一网页资源为加载当前网页所需的网页资源;
步骤103,依据所述URL查找当前网页匹配的浏览器内核;
步骤104,当所述当前网页匹配的浏览器内核为第二浏览器内核时,启动所述第二浏览器内核;
步骤105,采用所述第二浏览器内核基于所述第一浏览器内核传输的第一网页资源和第二网页资源,进行当前网页的加载;
其中,所述第二网页资源为所述第一浏览器内核从服务器侧获取的,除所述第一网页资源外的加载当前网页所需的剩余网页资源。
本发明中,当判定当前网页适于采用第二浏览器内核加载时启动第二浏览器内核,进行浏览器内核的切换,对于原浏览器内核进行请求时获取的已缓存的网页资源的进行重复使用,并请求获取到未进行缓存的网页资源,然后通过IPC将获取的全部网页资源发送到第二浏览器内核中进行渲染加载,避免了重复获取网页资源,提高了网页的加载速度。
参照图2,示出了根据本发明一个实施例的一种进行网页加载的方法实施例2的步骤流程图,具体可以包括以下步骤:
步骤201,在浏览器侧采用第一浏览器内核接收当前网页的第一加载请求;所述第一加载请求中包括当前网页的URL;
需要说明的是,浏览器可以包括两个或两个以上的浏览器内核,第一浏览器内核可以为浏览器当前默认使用的浏览器内核,该默认的浏览器内核可以是系统设置的,也可以使用户设置的,具体可以是Webkit内核等高性能的浏览器内核。当然,还可以是Gecko内核、Presto内核等 等,本发明实施例对此不加以限制。
当前网页的第一加载请求可以是指用户发出的加载某个网页的指示。例如,用户可以通过点击某链接来打开一个网页,或者在地址栏输入网址来打开一个网页等等。当用户点击某链接的指示时,就相当于接收到了用户加载网页的加载请求;同样,当在地址栏输入某网址并点击确定按钮或按下回车键时,也相当于接收到了用户加载网页的加载请求。
其中,加载请求的内容可以包括用户请求加载的网页的标识和/或网页的特征。网页标识可以是能够代表一个唯一确定的网页的信息,例如统一资源标识符(Uniform Resource Identifier,URI),统一资源标识符又具体可以包括统一资源定位符(Uniform Resource Locator,URL),或者统一资源名称(Uniform Resource Name,URN)等等。
在具体实现中,第一浏览器内核可以包括第一内核进程和第二内核进程。
内核进程可以是浏览器执行程序和分配资源的单位。
在本发明的一种优选实施例中,步骤201具体可以包括如下子步骤:
子步骤S11,在浏览器侧通过所述第一内核进程接收当前网页的第一加载请求。
具体实现中,第一内核进程可以获取当前网页的URL,当然也可以是获取当前网页的URI和/或URN等网页标识,本发明实施例对此不加限制。
步骤202,依据所述第一加载请求开始获取并缓存第一网页资源;所述第一网页资源为加载当前网页所需的网页资源;
当接收到用户加载网页的加载请求时,可以通过第一内核进程进行正常的网页加载。
在本发明的一种优选实施例中,步骤202具体可以包括如下子步骤:
子步骤S21,采用所述第一内核进程访问所述URL开始获取并缓存加 载当前网页所需的资源。
具体而言,可以采用第一内核进程直接访问URL加载当前网页。当然,也可以采用URI和/或URN等网页标识进行当前网页的加载。
以采用第一内核进程访问URL加载当前网页为例,加载网页的过程可以如下:
1.当检测到用户输入网址(假设是个HTML页面,并且是第一次访问)时,浏览器向服务器发出请求加载该网址指示的网页,服务器返回对应的HTML文本;
2.浏览器开始载入HTML文本的源代码,当检测到<head>标签内有一个<link>标签时,则需要引用外部CSS文件;
3.浏览器向服务器发出CSS文件的请求,服务器返回对应的CSS文件;
4.浏览器继续载入HTML文本中<body>部分的代码,此时CSS文件已经接收到,可以开始渲染网页;
5.当浏览器在HTML文本中检测到一个<img>标签时,需要引用了一张图片,则向服务器发送加载图片的请求。此时浏览器不会等待图片下载完,而是继续渲染后面的代码;
6.服务器返回图片文件,由于图片占用了一定面积,影响了后面段落的排布,因此浏览器需要重新渲染这部分代码;
7.当浏览器检测到一个包含一行JavaScript代码的<script>标签时,则立即运行;
8.采用JavaScript脚本执行了上述语句,其命令浏览器隐藏掉代码中的某个<div>(style.display=”none”),由于缺少了<div>元素,浏览器需要重新渲染这部分代码;
9.当检测到</HTML>时,渲染完成;
10.当用户点击界面中的“换肤”按钮,JavaScript让浏览器换了<link>标签的CSS路径;
11.浏览器采用<div>、<span>、<ul>、<li>等各元素,并向服 务器请求新的CSS文件,重新渲染页面。
在通过第一内核进程进行正常的网页加载,可以判断当前请求加载的网页所适配的浏览器内核。
步骤203,依据所述URL查找当前网页匹配的浏览器内核;
在具体实现中,获知用户请求的网页与浏览器内核之间的适配关系(即当前网页适于采用哪个浏览器内核进行加载)的方法可以有多种。
其中一种方法,可以根据从请求信息获得的内容以及预置规则,获知用户请求的网页与所述浏览器内核之间的适配关系。
具体而言,预置规则可以包括特定适配规则、通用适配规则和/或不适配规则,在请求加载网页的过程中,可以根据特定适配规则、通用适配规则和/或不适配规则,获知用户请求的网页与浏览器内核之间的适配关系。其中,特定适配规则可以包括网页与内核之间的适配关系,通用适配规则可以包括为用户选择平均加载速度最快的浏览器内核或为用户选择对网络标准支持最好的浏览器内核,不适配规则可以包括网页与内核之间的不适配关系。
由于浏览器还会根据接收到的加载请求向对应的服务器发送关于加载网页的加载请求信息,服务器会针对加载请求信息返回响应信息,在响应信息中会携带一些网页的页面内容等信息,因此在此种情形下,还可以根据从服务器返回的针对加载请求信息的响应信息获得的内容以及预置规则,重新获知与用户请求的网页适配的浏览器内核;如果重新获知的适配的浏览器内核与此前基于请求信息获知的适配浏览器内核不同,则选择重新获知的适配浏览器内核加载用户请求的网页。
另外一种方法中,由于浏览器还会根据接收到的加载请求向对应的服务器发送关于加载网页的加载请求信息,服务器会针对加载请求信息返回响应信息,在响应信息中会携带一些网页的页面内容等信息,因此在该方法中,可以直接根据从服务器返回的针对加载请求信息返回的响应信息获取的内容以及预置规则,获知用户请求的网页与浏览器内核之间的适配关系。
当然,也可以根据从加载请求获得的内容、从服务器返回的针对加载请求信息返回的响应信息获取的内容以及预置规则,共同获知用户请求的网页与浏览器内核之间的适配关系。
另外,在使用上述各实施例提供的方法加载网页时,还可以对加载用户请求的网页的情况进行检测;如果出现符合预置内核切换条件的现象,则根据预置规则重新获知与该网页适配的浏览器内核;选择重新获知的适配的浏览器内核加载用户请求的网页。其中,符合预置内核切换条件的现象可以包括:在加载过程中检测所加载速度较慢,或者在加载完毕后检测到网页没有正常显示,等等。
在本发明的一种优选实施例中,所述步骤203具体可以包括如下子步骤:
子步骤S31,在预置的资源映射表中查找所述URL对应的JavaScript资源。
子步骤S32,在预置的插件映射表中查找所述JavaScript资源对应的插件对象;
子步骤S33,确定所述插件对象适于运行的浏览器内核为当前网页匹配的浏览器内核。
加载网页需要的页面资源可以包括HTML页面中的JavaScript、css、图片和/或字体文件等资源。JavaScript、css、图片和/或字体文件等页面资源可以用于页面的渲染。
其中,JavaScript是一种脚本语言,其源代码在发往客户端运行之前不需经过编译,而是将文本格式的字符代码发送给浏览器由浏览器解释运行。解释语言的弱点是安全性较差,而且在JavaScript中,如果一条运行不了,那么下面的语言也无法运行。而且由于每次重新加载都会重新解译,加载后,有些代码会延迟至运行时才解译,甚至会多次解译,所以网页加载的速度较慢。
因此,为了提高网页加载的效率,可以调用JavaScript所适配的浏览器内核进行当前网页的加载。例如,各浏览器平均加载网页速度可能各 不相同,根据在同等条件下的测试,Presto内核执行同等JavaScript所需的时间仅有Trident和Gecko内核的约1/3。
在具体实现中,可以在浏览器或者服务器预置资源映射表,资源映射表中可以记载加载不同网页(具体可以采用URL进行标识不同的网页,也可以采用URI和/或URN标识不同的网页)所对应的页面资源,具体可以包括JavaScript。
可以在浏览器或服务器预置插件映射表,插件映射表中可以记载不同JavaScript所对应启动的插件对象。在具体实现中,使用第一浏览器内核进行网页资源的请求后获得网页资源,并返回到浏览器侧缓存中的网页资源数据,例如HTML文本、图片、视频元素,以及其中嵌入的例如JavaScript或者插件对象,这些数据会被浏览器在网页加载时进行渲染后进行显示。在解析这些网页资源进行渲染前,可以查询由浏览器进行维护的JavaScript的名称。这些维护的JavaScript可以用于与不同的网页进行匹配,即在不同网页的URL会对应不同的JavaScript的匹配项。
还可以在在浏览器或者服务器预置浏览器内核映射表。浏览器内核映射表中可以记载加载不同插件对象所适配的浏览器内核。具体实现中,可以对网页资源中的插件对象进行加载和初始化时的监听:对于网页中的<embed>元素,其中的CLSID(指系统对于不同的应用程序,文件类型,OLE对象,特殊文件夹以及各种系统组件分配一个唯一表示的ID代码)会被作为网页资源的一部分而被识别到,CLSID是网页插件对象的唯一识别码。对于匹配到指定的插件对象时,就切换到对应的浏览器内核,以使用该浏览器内核实现网页的再渲染和加载。
例如,在预置资源映射表中查找到在当前网页下点击进行文件下载需要激活一JavaScript脚本,此JavaScript脚本会对应启动一下载工具,此下载工具更适合运行在Trident内核的浏览器下,则获知适配关系为当前网页适于采用Trident内核进行加载。
需要说明的是,资源映射表、插件映射表、浏览器内核映射表中的一个、两个或三个可以合并在同一个映射表中。
相对应地,若在浏览器预置资源映射表、插件映射表和/或浏览器内核映射表,则可以在本地进行对应的查找。若在服务器预置资源映射表、插件映射表和/或浏览器内核映射表,则可以发送对应的查找请求,并接收服务器返回的信息。
步骤204,当所述当前网页匹配的浏览器内核为第二浏览器内核时,启动所述第二浏览器内核;
一般而言,第二浏览器内核可以为浏览器内置的除第一浏览器内核外的其他浏览器内核,可以在某些情况适配当前网页的加载,可以为Trident内核(即IE内核),包括IE-com内核(兼容的IE内核)和/或IE-stand内核。当然,还可以是Gecko内核、Presto内核等等,本发明实施例对此不加以限制。
特别地,当当前网页适于采用第一浏览器内核进行加载时,可以直接采用第一浏览器内核进行当前网页的加载。
在实际应用中,第二浏览器内核可以包括第三内核进程。需要说明的是,一个浏览器可以运行一个或多个内核进程,并不仅仅限制在第一内核进程、第二内核进程和第三内核进程。
在本发明的一种优选实施例中,步骤204具体可以包括如下子步骤:
子步骤S41,中止所述第一内核进程获取并缓存加载当前网页所需的资源;
子步骤S42,启动所述第三内核进程;
子步骤S43,采用所述第一内核进程将当前网页的URL传输给所述第三内核进程。
在确定进行浏览器内核转换后,会停止当前浏览器内核(即第一浏览器内核)加载当前网页。当前通过第一内核进程所能加载到的网页资源可以称之为第一网页资源。需要说明的是,何时获知用户请求的网页与浏览器内核之间的适配关系,何时就中止采用第一内核进程获取并缓存加载当前网页所需的资源。
第一内核进程可以将当前网页URL传递到第三内核进程中,也可以将当前网页的URI和/或URN等网页标识传递到第三内核进程中,本发明实施例对此不加以限制。
步骤205,当监听到所述第二浏览器内核请求加载当前网页时,采用所述第一浏览器内核生成当前网页的第二加载请求;
在切换到第二浏览器内核后,可以通过第二浏览内核使用当前网页的URL去发起一个新的浏览器导航。
在本发明的一种优选实施例中,所述步骤205具体可以包括如下子步骤:
子步骤S51:调用网络编程接口WinInet启动管理会话类CInternetSession;
子步骤S52:当在所述管理会话类CInternetSession中监听到所述第二内核进程加载网页的请求时,提取所述请求中的URL;
子步骤S53:判断所述请求中的URL与当前网页的URL是否相同;若是,则将当前网页的URL传输到所述第二内核进程中;
子步骤S54:采用所述第二内核进程针对当前网页的URL生成当前网页的第二加载请求。
在第三内核进程中注册监听HTTP请求或者HTTPS请求,在WinInet(是Windows Internet扩展应用程序编程接口,是专为开发具有Internet功能的客户端应用程序而提供的,可以支持HTTP协议,FTP协议和GOPHER协议)中进行一个CinternetSession对象,可以对每一个监听到的HTTP请求或者HTTPS请求,继而识别出该HTTP请求中或者HTTPS请求的URL。若判断该URL为当前网页的URL,则依据当前网页的URL进行IPC(Inter-Process Communication,进程间通信,指至少两个进程或线程间传送数据或信号的一些技术或方法)将第三内核进程中的URL传递给第三内核进程中。在第三内核进程中依据该URL进行一个基于第一浏览器内核的HTTP请求。
步骤206,依据所述第二加载请求采用所述第一浏览器内核获取第 一网页资源;
所述第一网页资源为所述第一浏览器内核针对所述第一加载请求所获取并缓存的网页资源;
第一网页资源已存储在本地的缓存中,为避免重复请求网页资源,进一步加快网页资源的请求,可以直接采用该第一网页资源进行当前网页的加载。
在本发明的一种优选实施例中,所述步骤206具体可以包括如下子步骤:
子步骤S51,提取所述第二加载请求中当前网页的URL;
子步骤S52,判断浏览器缓存中是否有所述URL对应的网页资源;若是,则采用所述第二内核进程提取所述URL对应的网页资源。
第一浏览器内核中会在向该URL对应的服务器请求网页资源之前,会在本地的缓存中的资源的查询,如果有已经下载的该URL对应的资源,就不会再向该服务器进行请求,而是直接使用该已经缓存的资源。
步骤207,采用所述第一浏览器内核从服务器侧获取第二网页资源;
其中,所述第二网页资源为所述第一浏览器内核从服务器侧获取的,除所述第一网页资源外的加载当前网页所需的剩余网页资源。
在中止第一内核进程获取并缓存加载当前网页所需的资源时,第一内核进程所获取的第一网页资源可能并不是加载当前网页所需的全部网页资源,对于加载当前网页所需的剩余网页资源,可以向服务器发送请求获取。
在本发明的一种优选实施例中,所述步骤207具体可以包括如下子步骤:
子步骤S71,在所述第二内核进程中,将用户代理UserAgent设置为指示第二浏览器内核的标识;
子步骤S72,通过访问当前网页的URL向服务器侧请求加载当前网页;所述请求中包括第二网页资源的标识;所述服务器用于提取第二网 页资源;
子步骤S73,接收所述服务器侧返回的第二网页资源。
对于没有下载的该URL对应的网页资源(即第二网页资源),可以生成一个基于第一浏览器内核架构的请求去请求尚未没有下载的网页资源。在具体实现中,对于已经下载的网页资源(即第一网页资源)和没有下载的网页资源,可以使用不同的标记,将这两种网页资源进行标记分开。但是该基于第一浏览器内核架构的请求中的用户代理UserAgent的参数是需要设置为指示第二浏览器内核的标识。
当然,对于获取到的第二网页资源,也可以存储在本地的缓存中。
步骤208,采用所述第一浏览器内核将所述第一网页资源和第二网页资源传输到所述第二浏览器内核进行当前网页的加载。
第一网页资源和第二网页资源可以为加载当前网页所需的全部资源,当第二浏览器内核将获取到第一网页资源和第二网页资源后,可以采用第二浏览器内核进行当前网页的渲染。
在本发明的一种优选实施例中,所述步骤208具体可以包括如下子步骤:
子步骤S81,在所述第二内核进程中采用进程间通信IPC分别将所述第一网页资源和所述第二网页资源传输到所述第三内核进程中;
子步骤S82,采用所述第三内核进程采用所述第一网页资源和所述第二网页资源渲染当前网页。
具体实现中,通过IPC通信将该已经缓存的网页资源(第一网页资源和第二网页资源)传输到第三内核进程,第二浏览器内核的read函数获取该已经缓存的网页资源,并进行后续的渲染和显示。
本发明中,当判定当前网页适于采用第二浏览器内核加载时启动第二浏览器内核,进行浏览器内核的切换,对于原浏览器内核进行请求时获取的已缓存的网页资源的进行重复使用,并请求获取到未进行缓存的网页资源,然后通过IPC将获取的全部网页资源发送到第二浏览器内核中进行渲染加载,避免了重复获取网页资源,提高了网页的加载速度。
本发明中,在网页进行渲染前进行适配浏览器内核的判断,通过使用了资源映射表查找当前网页URL对应的JavaScript资源,在通过插件映射表查找该JavaScript资源对应的插件对象,最后确定适配的浏览器内核,提高了采用浏览器内核加载网页的适配程度,提高了加载网页的效率。
参照图3,示出了根据本发明一个实施例的一种进行网页加载的装置实施例的结构框图,具体可以包括如下模块:
第一加载请求接收模块301,适于在浏览器侧采用第一浏览器内核接收当前网页的第一加载请求;所述第一加载请求中包括当前网页的URL;
第一网页资源获取模块302,适于依据所述第一加载请求开始获取并缓存第一网页资源;所述第一网页资源为加载当前网页所需的网页资源;
浏览器内核匹配模块303,适于依据所述URL查找当前网页匹配的浏览器内核;
第二浏览器内核启动模块304,适于在所述当前网页匹配的浏览器内核为第二浏览器内核时,启动所述第二浏览器内核;
网页加载模块305,适于采用所述第二浏览器内核基于所述第一浏览器内核传输的第一网页资源和第二网页资源,进行当前网页的加载;
其中,所述第二网页资源为所述第一浏览器内核从服务器侧获取的,除所述第一网页资源外的加载当前网页所需的剩余网页资源。
在本发明的一种优选实施例中,所述网页加载模块还适于:
当监听到所述第二浏览器内核请求加载当前网页时,采用所述第一浏览器内核生成当前网页的第二加载请求;
依据所述第二加载请求采用所述第一浏览器内核获取第一网页资源;
采用所述第一浏览器内核从服务器侧获取第二网页资源;
采用所述第一浏览器内核将所述第一网页资源和第二网页资源传输到所述第二浏览器内核进行当前网页的加载。
在本发明的一种优选实施例中,所述第一浏览器内核包括第一内核进 程和第二内核进程,所述第二浏览器内核包括第三内核进程。
在本发明的一种优选实施例中,所述第一加载请求接收模块还适于:
在浏览器侧通过所述第一内核进程接收当前网页的第一加载请求。
在本发明的一种优选实施例中,所述第一网页资源获取模块还适于:
采用所述第一内核进程访问所述URL开始获取并缓存加载当前网页所需的资源。
在本发明的一种优选实施例中,所述浏览器内核匹配模块还适于:
在预置的资源映射表中查找所述URL对应的JavaScript资源。
在预置的插件映射表中查找所述JavaScript资源对应的插件对象;
确定所述插件对象适于运行的浏览器内核为当前网页匹配的浏览器内核。
在本发明的一种优选实施例中,所述第二浏览器内核启动模块还适于:
中止所述第一内核进程获取并缓存加载当前网页所需的资源;
启动所述第三内核进程;
采用所述第一内核进程将当前网页的URL传输给所述第三内核进程。
在本发明的一种优选实施例中,所述网页加载模块还适于:
调用网络编程接口WinInet启动管理会话类CInternetSession;
当在所述管理会话类CInternetSession中监听到所述第二内核进程加载网页的请求时,提取所述请求中的URL;
判断所述请求中的URL与当前网页的URL是否相同;若是,则将当前网页的URL传输到所述第二内核进程中;
采用所述第二内核进程针对当前网页的URL生成当前网页的第二加载请求。
在本发明的一种优选实施例中,所述网页加载模块还适于:
提取所述第二加载请求中当前网页的URL;
判断浏览器缓存中是否有所述URL对应的网页资源;若是,则采用所 述第二内核进程提取所述URL对应的网页资源。
在本发明的一种优选实施例中,所述网页加载模块还适于:
在所述第二内核进程中,将用户代理UserAgent设置为指示第二浏览器内核的标识;
通过访问当前网页的URL向服务器侧请求加载当前网页;所述请求中包括第二网页资源的标识;所述服务器用于提取第二网页资源;
接收所述服务器侧返回的第二网页资源。
在本发明的一种优选实施例中,所述网页加载模块还适于:
在所述第二内核进程中采用进程间通信IPC分别将所述第一网页资源和所述第二网页资源传输到所述第三内核进程中;
采用所述第三内核进程采用所述第一网页资源和所述第二网页资源渲染当前网页。
对于装置实施例而言,由于其与方法实施例基本相似,所以描述的比较简单,相关之处参见方法实施例的部分说明即可。
本发明还提供了一种浏览器,具体可以包括如下模块:
第一加载请求接收模块,适于在浏览器侧采用第一浏览器内核接收当前网页的第一加载请求;所述第一加载请求中包括当前网页的URL;
第一网页资源获取模块,适于依据所述第一加载请求开始获取并缓存第一网页资源;所述第一网页资源为加载当前网页所需的网页资源;
浏览器内核匹配模块,适于依据所述URL查找当前网页匹配的浏览器内核;
第二浏览器内核启动模块,适于在所述当前网页匹配的浏览器内核为第二浏览器内核时,启动所述第二浏览器内核;
网页加载模块,适于采用所述第二浏览器内核基于所述第一浏览器内核传输的第一网页资源和第二网页资源,进行当前网页的加载;
其中,所述第二网页资源为所述第一浏览器内核从服务器侧获取的,除所述第一网页资源外的加载当前网页所需的剩余网页资源。
在本发明的一种优选实施例中,所述网页加载模块还适于:
当监听到所述第二浏览器内核请求加载当前网页时,采用所述第一浏览器内核生成当前网页的第二加载请求;
依据所述第二加载请求采用所述第一浏览器内核获取第一网页资源;
采用所述第一浏览器内核从服务器侧获取第二网页资源;
采用所述第一浏览器内核将所述第一网页资源和第二网页资源传输到所述第二浏览器内核进行当前网页的加载。
在本发明的一种优选实施例中,所述第一浏览器内核包括第一内核进程和第二内核进程,所述第二浏览器内核包括第三内核进程。
在本发明的一种优选实施例中,所述第一加载请求接收模块还适于:
在浏览器侧通过所述第一内核进程接收当前网页的第一加载请求。
在本发明的一种优选实施例中,所述第一网页资源获取模块还适于:
采用所述第一内核进程访问所述URL开始获取并缓存加载当前网页所需的资源。
在本发明的一种优选实施例中,所述浏览器内核匹配模块还适于:
在预置的资源映射表中查找所述URL对应的JavaScript资源。
在预置的插件映射表中查找所述JavaScript资源对应的插件对象;
确定所述插件对象适于运行的浏览器内核为当前网页匹配的浏览器内核。
在本发明的一种优选实施例中,所述第二浏览器内核启动模块还适于:
中止所述第一内核进程获取并缓存加载当前网页所需的资源;
启动所述第三内核进程;
采用所述第一内核进程将当前网页的URL传输给所述第三内核进程。
在本发明的一种优选实施例中,所述网页加载模块还适于:
调用网络编程接口WinInet启动管理会话类CInternetSession;
当在所述管理会话类CInternetSession中监听到所述第二内核进程加载 网页的请求时,提取所述请求中的URL;
判断所述请求中的URL与当前网页的URL是否相同;若是,则将当前网页的URL传输到所述第二内核进程中;
采用所述第二内核进程针对当前网页的URL生成当前网页的第二加载请求。
在本发明的一种优选实施例中,所述网页加载模块还适于:
提取所述第二加载请求中当前网页的URL;
判断浏览器缓存中是否有所述URL对应的网页资源;若是,则采用所述第二内核进程提取所述URL对应的网页资源。
在本发明的一种优选实施例中,所述网页加载模块还适于:
在所述第二内核进程中,将用户代理UserAgent设置为指示第二浏览器内核的标识;
通过访问当前网页的URL向服务器侧请求加载当前网页;所述请求中包括第二网页资源的标识;所述服务器用于提取第二网页资源;
接收所述服务器侧返回的第二网页资源。
在本发明的一种优选实施例中,所述网页加载模块还适于:
在所述第二内核进程中采用进程间通信IPC分别将所述第一网页资源和所述第二网页资源传输到所述第三内核进程中;
采用所述第三内核进程采用所述第一网页资源和所述第二网页资源渲染当前网页。
本发明的各个部件实施例可以以硬件实现,或者以在一个或者多个处理器上运行的软件模块实现,或者以它们的组合实现。本领域的技术人员应当理解,可以在实践中使用微处理器或者数字信号处理器(DSP)来实现根据本发明实施例的进行网页加载的设备中的一些或者全部部件的一些或者全部功能。本发明还可以实现为用于执行这里所描述的方法的一部分或者全部的设备或者装置程序(例如,计算机程序和计算机程序产品)。这样的实现本发明的程序可以存储在计算机可读介质上,或者可以具有一个或者多个信号的形式。这样的信号可以从因特网网站上下载得到,或者在载 体信号上提供,或者以任何其他形式提供。
例如,图4示出了可以实现根据本发明的进行网页加载的服务器,例如电脑、移动设备。该电子设备传统上包括处理器410和以存储器420形式的计算机程序产品或者计算机可读介质。存储器420可以是诸如闪存、EEPROM(电可擦除可编程只读存储器)、EPROM、硬盘或者ROM之类的电子存储器。存储器420具有用于执行上述方法中的任何方法步骤的程序代码431的存储空间430。例如,用于程序代码的存储空间430可以包括分别用于实现上面的方法中的各种步骤的各个程序代码431。这些程序代码可以从一个或者多个计算机程序产品中读出或者写入到这一个或者多个计算机程序产品中。这些计算机程序产品包括诸如硬盘,紧致盘(CD)、存储卡或者软盘之类的程序代码载体。这样的计算机程序产品通常为如参考图5所述的便携式或者固定存储单元。该存储单元可以具有与图4的电子设备中的存储器420类似布置的存储段、存储空间等。程序代码可以例如以适当形式进行压缩。通常,存储单元包括计算机可读代码431’,即可以由例如诸如410之类的处理器读取的代码,这些代码当由电子设备运行时,导致该电子设备执行上面所描述的方法中的各个步骤。
本文中所称的“一个实施例”、“实施例”或者“一个或者多个实施例”意味着,结合实施例描述的特定特征、结构或者特性包括在本发明的至少一个实施例中。此外,请注意,这里“在一个实施例中”的词语例子不一定全指同一个实施例。
在此处所提供的说明书中,说明了大量具体细节。然而,能够理解,本发明的实施例可以在没有这些具体细节的情况下被实践。在一些实例中,并未详细示出公知的方法、结构和技术,以便不模糊对本说明书的理解。
应该注意的是上述实施例对本发明进行说明而不是对本发明进行限制,并且本领域技术人员在不脱离所附权利要求的范围的情况下可设计出替换实施例。在权利要求中,不应将位于括号之间的任何参考符号构造成 对权利要求的限制。单词“包含”不排除存在未列在权利要求中的元件或步骤。位于元件之前的单词“一”或“一个”不排除存在多个这样的元件。本发明可以借助于包括有若干不同元件的硬件以及借助于适当编程的计算机来实现。在列举了若干装置的单元权利要求中,这些装置中的若干个可以是通过同一个硬件项来具体体现。单词第一、第二、以及第三等的使用不表示任何顺序。可将这些单词解释为名称。
此外,还应当注意,本说明书中使用的语言主要是为了可读性和教导的目的而选择的,而不是为了解释或者限定本发明的主题而选择的。因此,在不偏离所附权利要求书的范围和精神的情况下,对于本技术领域的普通技术人员来说许多修改和变更都是显而易见的。对于本发明的范围,对本发明所做的公开是说明性的,而非限制性的,本发明的范围由所附权利要求书限定。

Claims (25)

  1. 一种进行网页加载的方法,包括:
    在浏览器侧采用第一浏览器内核接收当前网页的第一加载请求;所述第一加载请求中包括当前网页的URL;
    依据所述第一加载请求开始获取并缓存第一网页资源;所述第一网页资源为加载当前网页所需的网页资源;
    依据所述URL查找当前网页匹配的浏览器内核;
    当所述当前网页匹配的浏览器内核为第二浏览器内核时,启动所述第二浏览器内核;
    采用所述第二浏览器内核基于所述第一浏览器内核传输的第一网页资源和第二网页资源,进行当前网页的加载;
    其中,所述第二网页资源为所述第一浏览器内核从服务器侧获取的,除所述第一网页资源外的加载当前网页所需的剩余网页资源。
  2. 如权利要求1所述的方法,其特征在于,所述采用所述第二浏览器内核基于所述第一浏览器内核传输的第一网页资源和第二网页资源,进行当前网页的加载的步骤包括:
    当监听到所述第二浏览器内核请求加载当前网页时,采用所述第一浏览器内核生成当前网页的第二加载请求;
    依据所述第二加载请求采用所述第一浏览器内核获取第一网页资源;
    采用所述第一浏览器内核从服务器侧获取第二网页资源;
    采用所述第一浏览器内核将所述第一网页资源和第二网页资源传输到所述第二浏览器内核进行当前网页的加载。
  3. 如权利要求1或2所述的方法,其特征在于,所述第一浏览器内核包括第一内核进程和第二内核进程,所述第二浏览器内核包括第三内核进程。
  4. 如权利要求3所述的方法,其特征在于,所述在浏览器侧采用所述第一浏览器内核接收当前网页的第一加载请求的步骤包括:
    在浏览器侧通过所述第一内核进程接收当前网页的第一加载请求。
  5. 如权利要求3所述的方法,其特征在于,所述依据所述第一加载请 求开始获取并缓存第一网页资源的步骤包括:
    采用所述第一内核进程访问所述URL开始获取并缓存加载当前网页所需的资源。
  6. 如权利要求1或4或5所述的方法,其特征在于,所述依据所述当前网页的URL查找当前网页匹配的浏览器内核的步骤包括:
    在预置的资源映射表中查找所述URL对应的JavaScript资源。
    在预置的插件映射表中查找所述JavaScript资源对应的插件对象;
    确定所述插件对象适于运行的浏览器内核为当前网页匹配的浏览器内核。
  7. 如权利要求4或5所述的方法,其特征在于,所述启动所述第二浏览器内核的步骤包括:
    中止所述第一内核进程获取并缓存加载当前网页所需的资源;
    启动所述第三内核进程;
    采用所述第一内核进程将当前网页的URL传输给所述第三内核进程。
  8. 如权利要求7所述的方法,其特征在于,所述当监听到所述第二浏览器内核请求加载当前网页时,采用所述第一浏览器内核生成当前网页的第二加载请求的步骤包括:
    调用网络编程接口WinInet启动管理会话类CInternetSession;
    当在所述管理会话类CInternetSession中监听到所述第二内核进程加载网页的请求时,提取所述请求中的URL;
    判断所述请求中的URL与当前网页的URL是否相同;若是,则将当前网页的URL传输到所述第二内核进程中;
    采用所述第二内核进程针对当前网页的URL生成当前网页的第二加载请求。
  9. 如权利要求8所述的方法,其特征在于,所述依据所述第二加载请求采用所述第一浏览器内核获取第一网页资源的步骤包括:
    提取所述第二加载请求中当前网页的URL;
    判断浏览器缓存中是否有所述URL对应的网页资源;若是,则采用所 述第二内核进程提取所述URL对应的网页资源。
  10. 如权利要求8所述的方法,其特征在于,所述采用所述第一浏览器内核从服务器侧获取第二网页资源的步骤包括:
    在所述第二内核进程中,将用户代理UserAgent设置为指示第二浏览器内核的标识;
    通过访问当前网页的URL向服务器侧请求加载当前网页;所述请求中包括第二网页资源的标识;所述服务器用于提取第二网页资源;
    接收所述服务器侧返回的第二网页资源。
  11. 如权利要求3所述的方法,其特征在于,所述采用所述第一浏览器内核将所述第一网页资源和第二网页资源传输到所述第二浏览器内核进行当前网页的加载的步骤包括:
    在所述第二内核进程中采用进程间通信IPC分别将所述第一网页资源和所述第二网页资源传输到所述第三内核进程中;
    采用所述第三内核进程采用所述第一网页资源和所述第二网页资源渲染当前网页。
  12. 一种进行网页加载的装置,包括:
    第一加载请求接收模块,适于在浏览器侧采用第一浏览器内核接收当前网页的第一加载请求;所述第一加载请求中包括当前网页的URL;
    第一网页资源获取模块,适于依据所述第一加载请求开始获取并缓存第一网页资源;所述第一网页资源为加载当前网页所需的网页资源;
    浏览器内核匹配模块,适于依据所述URL查找当前网页匹配的浏览器内核;
    第二浏览器内核启动模块,适于在所述当前网页匹配的浏览器内核为第二浏览器内核时,启动所述第二浏览器内核;
    网页加载模块,适于采用所述第二浏览器内核基于所述第一浏览器内核传输的第一网页资源和第二网页资源,进行当前网页的加载;
    其中,所述第二网页资源为所述第一浏览器内核从服务器侧获取的, 除所述第一网页资源外的加载当前网页所需的剩余网页资源。
  13. 如权利要求12所述的装置,其特征在于,所述网页加载模块还适于:
    当监听到所述第二浏览器内核请求加载当前网页时,采用所述第一浏览器内核生成当前网页的第二加载请求;
    依据所述第二加载请求采用所述第一浏览器内核获取第一网页资源;
    采用所述第一浏览器内核从服务器侧获取第二网页资源;
    采用所述第一浏览器内核将所述第一网页资源和第二网页资源传输到所述第二浏览器内核进行当前网页的加载。
  14. 如权利要求12或13所述的装置,其特征在于,所述第一浏览器内核包括第一内核进程和第二内核进程,所述第二浏览器内核包括第三内核进程。
  15. 如权利要求14所述的装置,其特征在于,所述第一加载请求接收模块还适于:
    在浏览器侧通过所述第一内核进程接收当前网页的第一加载请求。
  16. 如权利要求14所述的装置,其特征在于,所述第一网页资源获取模块还适于:
    采用所述第一内核进程访问所述URL开始获取并缓存加载当前网页所需的资源。
  17. 如权利要求12或15或16所述的装置,其特征在于,所述浏览器内核匹配模块还适于:
    在预置的资源映射表中查找所述URL对应的JavaScript资源。
    在预置的插件映射表中查找所述JavaScript资源对应的插件对象;
    确定所述插件对象适于运行的浏览器内核为当前网页匹配的浏览器内核。
  18. 如权利要求15或16所述的装置,其特征在于,所述第二浏览器内核启动模块还适于:
    中止所述第一内核进程获取并缓存加载当前网页所需的资源;
    启动所述第三内核进程;
    采用所述第一内核进程将当前网页的URL传输给所述第三内核进程。
  19. 如权利要求18所述的装置,其特征在于,所述网页加载模块还适于:
    调用网络编程接口WinInet启动管理会话类CInternetSession;
    当在所述管理会话类CInternetSession中监听到所述第二内核进程加载网页的请求时,提取所述请求中的URL;
    判断所述请求中的URL与当前网页的URL是否相同;若是,则将当前网页的URL传输到所述第二内核进程中;
    采用所述第二内核进程针对当前网页的URL生成当前网页的第二加载请求。
  20. 如权利要求19所述的装置,其特征在于,所述网页加载模块还适于:
    提取所述第二加载请求中当前网页的URL;
    判断浏览器缓存中是否有所述URL对应的网页资源;若是,则采用所述第二内核进程提取所述URL对应的网页资源。
  21. 如权利要求20所述的装置,其特征在于,所述网页加载模块还适于:
    在所述第二内核进程中,将用户代理UserAgent设置为指示第二浏览器内核的标识;
    通过访问当前网页的URL向服务器侧请求加载当前网页;所述请求中包括第二网页资源的标识;所述服务器用于提取第二网页资源;
    接收所述服务器侧返回的第二网页资源。
  22. 如权利要求14所述的装置,其特征在于,所述网页加载模块还适于:
    在所述第二内核进程中采用进程间通信IPC分别将所述第一网页资源和所述第二网页资源传输到所述第三内核进程中;
    采用所述第三内核进程采用所述第一网页资源和所述第二网页资源渲 染当前网页。
  23. 一种浏览器,包括:
    第一加载请求接收模块,适于在浏览器侧采用第一浏览器内核接收当前网页的第一加载请求;所述第一加载请求中包括当前网页的URL;
    第一网页资源获取模块,适于依据所述第一加载请求开始获取并缓存第一网页资源;所述第一网页资源为加载当前网页所需的网页资源;
    浏览器内核匹配模块,适于依据所述URL查找当前网页匹配的浏览器内核;
    第二浏览器内核启动模块,适于在所述当前网页匹配的浏览器内核为第二浏览器内核时,启动所述第二浏览器内核;
    网页加载模块,适于采用所述第二浏览器内核基于所述第一浏览器内核传输的第一网页资源和第二网页资源,进行当前网页的加载;
    其中,所述第二网页资源为所述第一浏览器内核从服务器侧获取的,除所述第一网页资源外的加载当前网页所需的剩余网页资源。
  24. 一种计算机程序,包括计算机可读代码,当所述计算机可读代码在电子设备上运行时,导致所述电子设备执行根据权利要求1-11中的任一个所述的进行网页加载的方法。
  25. 一种计算机可读介质,其中存储了如权利要求24所述的计算机程序。
PCT/CN2014/086428 2013-09-27 2014-09-12 一种进行网页加载的方法、装置和浏览器 Ceased WO2015043383A1 (zh)

Priority Applications (1)

Application Number Priority Date Filing Date Title
US15/025,219 US20160232252A1 (en) 2013-09-27 2014-09-12 Method for loading webpage, device and browser thereof

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN201310459986.4A CN103500210A (zh) 2013-09-27 2013-09-27 一种进行网页加载的方法、装置和浏览器
CN201310459986.4 2013-09-27

Publications (1)

Publication Number Publication Date
WO2015043383A1 true WO2015043383A1 (zh) 2015-04-02

Family

ID=49865420

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2014/086428 Ceased WO2015043383A1 (zh) 2013-09-27 2014-09-12 一种进行网页加载的方法、装置和浏览器

Country Status (3)

Country Link
US (1) US20160232252A1 (zh)
CN (1) CN103500210A (zh)
WO (1) WO2015043383A1 (zh)

Cited By (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112507259A (zh) * 2020-12-15 2021-03-16 广州博冠信息科技有限公司 网页加载方法及装置、电子设备、存储介质
CN112612982A (zh) * 2021-01-05 2021-04-06 上海哔哩哔哩科技有限公司 网页预加载方法、装置及计算机设备
CN118276984A (zh) * 2024-05-29 2024-07-02 珠海儒特网络科技有限公司 一种浏览器引擎加载内核插件的方法及嵌入式装置和家电设备

Families Citing this family (24)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103500210A (zh) * 2013-09-27 2014-01-08 北京奇虎科技有限公司 一种进行网页加载的方法、装置和浏览器
CN104468834B (zh) * 2014-12-26 2017-12-26 北京奇虎科技有限公司 进行Cookie数据处理的方法、装置和浏览器客户端
CN106354484A (zh) * 2015-07-16 2017-01-25 中兴通讯股份有限公司 一种浏览器兼容方法及浏览器
CN106682037A (zh) * 2015-11-11 2017-05-17 百度在线网络技术(北京)有限公司 一种操作页面中的图片的方法和装置
CN107045501A (zh) * 2016-02-05 2017-08-15 腾讯科技(深圳)有限公司 一种网页访问方法和装置
CN106131109B (zh) * 2016-06-08 2019-07-30 北京京东尚科信息技术有限公司 基于http协议实现app内嵌网页中任意资源缓存的方法和装置
CN107844332A (zh) * 2016-09-20 2018-03-27 天脉聚源(北京)科技有限公司 一种移动网页加载外部资源的方法和系统
CN107016021A (zh) * 2016-11-08 2017-08-04 阿里巴巴集团控股有限公司 页面加载方法、客户端、系统和电子设备
CN107704615B (zh) * 2017-10-24 2022-01-04 北京有字库网络科技有限公司 基于中文字体子集化的网页字体显示方法及系统
CN108334379A (zh) * 2018-01-05 2018-07-27 北京明略软件系统有限公司 一种页面扩展功能的实现方法及实现装置
US11188353B2 (en) * 2018-07-12 2021-11-30 Vmware, Inc. Runtime extension system for bundled web application
CN109992326A (zh) * 2019-03-28 2019-07-09 武汉达梦数据库有限公司 一种数据访问方法以及相应的终端
CN112306587B (zh) * 2019-07-15 2025-03-04 腾讯科技(深圳)有限公司 页面的显示处理方法、装置、及终端设备
CN110795650A (zh) * 2019-09-18 2020-02-14 平安银行股份有限公司 网页开启方法、装置及计算机可读存储介质
CN111273965B (zh) * 2020-02-17 2021-10-29 支付宝(杭州)信息技术有限公司 一种容器应用启动方法、系统、装置及电子设备
CN111539025B (zh) * 2020-05-07 2021-02-26 北京五八信息技术有限公司 一种页面展示方法、装置、电子设备及存储介质
CN113778349B (zh) * 2020-06-10 2025-03-25 北京奇虎科技有限公司 页面的打印方法、装置、系统、设备及存储介质
CN111913757B (zh) * 2020-07-13 2025-04-22 西安即刻易用网络科技有限公司 一种单页面应用程序加载方法及系统
CN112286592A (zh) * 2020-10-29 2021-01-29 平安普惠企业管理有限公司 资源数据的加载方法及装置、存储介质、计算机设备
CN114217866B (zh) * 2021-11-08 2023-09-19 阿里健康科技(中国)有限公司 小程序的使用方法及装置和电子设备
CN114329281B (zh) * 2021-12-31 2025-10-28 北京升明科技有限公司 渲染服务器、网页渲染方法及装置
CN114942911A (zh) * 2022-06-16 2022-08-26 平安国际融资租赁有限公司 一种文件浏览方法、装置、设备及存储介质
CN117235398B (zh) * 2023-11-15 2024-02-23 深圳万物安全科技有限公司 网页加载方法、设备及可读存储介质
CN118276983B (zh) * 2024-05-29 2024-08-16 珠海儒特网络科技有限公司 浏览器引擎切换微内核组件的方法及嵌入式装置和家电设备

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20030197737A1 (en) * 2000-02-09 2003-10-23 Kim Jong Min 2D/3D web browsing system
CN101655863A (zh) * 2009-04-24 2010-02-24 北京搜狗科技发展有限公司 在浏览器中加载网页的方法及浏览器
CN102156709A (zh) * 2011-02-28 2011-08-17 奇智软件(北京)有限公司 一种浏览器引擎模式的切换方法
CN103500210A (zh) * 2013-09-27 2014-01-08 北京奇虎科技有限公司 一种进行网页加载的方法、装置和浏览器
CN103530329A (zh) * 2013-09-27 2014-01-22 北京奇虎科技有限公司 一种进行网页加载的方法、装置和浏览器

Family Cites Families (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102467565B (zh) * 2010-11-19 2016-05-11 北京奇虎科技有限公司 一种浏览器内核切换的方法

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20030197737A1 (en) * 2000-02-09 2003-10-23 Kim Jong Min 2D/3D web browsing system
CN101655863A (zh) * 2009-04-24 2010-02-24 北京搜狗科技发展有限公司 在浏览器中加载网页的方法及浏览器
CN102156709A (zh) * 2011-02-28 2011-08-17 奇智软件(北京)有限公司 一种浏览器引擎模式的切换方法
CN103500210A (zh) * 2013-09-27 2014-01-08 北京奇虎科技有限公司 一种进行网页加载的方法、装置和浏览器
CN103530329A (zh) * 2013-09-27 2014-01-22 北京奇虎科技有限公司 一种进行网页加载的方法、装置和浏览器

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
"No Repeated Download needed for Dual-core Switch! Sogou Browser Dual-core Sharing Cache", ENET SILICON VALLEY POWER, 16 October 2012 (2012-10-16), pages 1 - 6, Retrieved from the Internet <URL:http://www.enet.com.cn/article/2012/1016/A20121016175699.shtml> *

Cited By (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112507259A (zh) * 2020-12-15 2021-03-16 广州博冠信息科技有限公司 网页加载方法及装置、电子设备、存储介质
CN112612982A (zh) * 2021-01-05 2021-04-06 上海哔哩哔哩科技有限公司 网页预加载方法、装置及计算机设备
CN118276984A (zh) * 2024-05-29 2024-07-02 珠海儒特网络科技有限公司 一种浏览器引擎加载内核插件的方法及嵌入式装置和家电设备

Also Published As

Publication number Publication date
CN103500210A (zh) 2014-01-08
US20160232252A1 (en) 2016-08-11

Similar Documents

Publication Publication Date Title
CN103500210A (zh) 一种进行网页加载的方法、装置和浏览器
WO2015039586A1 (zh) 一种进行网页加载的方法、装置和浏览器
CN103530329A (zh) 一种进行网页加载的方法、装置和浏览器
CN102789470B (zh) 加载网页中的图片的方法和装置
US8887039B2 (en) Web page based program versioning
CN106126693B (zh) 一种网页的相关数据的发送方法及装置
CN105095280A (zh) 一种浏览器缓存方法和装置
US10447742B2 (en) Information sharing method and device
CN103559097B (zh) 一种浏览器中进程间通信的方法、装置和浏览器
CN103631905A (zh) 一种网页的加载方法和浏览器
US8447874B2 (en) Web page data streaming
WO2017012234A1 (zh) 一种信息获取方法、装置、设备及计算机存储介质
CN102768683B (zh) 一种图片信息的搜索方法及搜索装置
TW201800962A (zh) 網頁文件發送方法、網頁渲染方法及裝置、網頁渲染系統
CN104572777A (zh) 基于UIWebView组件的网页加载方法及装置
US20140039885A1 (en) Methods and apparatus for voice-enabling a web application
CN103164446A (zh) 一种网页请求信息的响应方法及装置
US9292252B2 (en) Methods and apparatus for voiced-enabling a web application
US9465814B2 (en) Annotating search results with images
TW201804340A (zh) 腳本生成方法與裝置
CN104283865A (zh) 一种下载处理方法、装置、服务器及客户端设备
CN104980464B (zh) 一种网络请求处理方法、网络服务器和网络系统
CN101115064A (zh) 一种网络数据的存储、获取方法及其实现装置
TWI519980B (zh) 網頁顯示方法和裝置及電腦可讀取儲存介質
CN104932910A (zh) 应用程序接口扩展的方法及系统

Legal Events

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

Ref document number: 14847945

Country of ref document: EP

Kind code of ref document: A1

WWE Wipo information: entry into national phase

Ref document number: 15025219

Country of ref document: US

NENP Non-entry into the national phase

Ref country code: DE

122 Ep: pct application non-entry in european phase

Ref document number: 14847945

Country of ref document: EP

Kind code of ref document: A1