Method and system for viewing web page and computer Program product thereof

Information

  • Patent Application
  • 20120054598
  • Publication Number
    20120054598
  • Date Filed
    August 26, 2011
    13 years ago
  • Date Published
    March 01, 2012
    12 years ago
Abstract
A method for viewing web pages, applied to an electronic device is provided. The method comprises the steps of: obtaining a web page; analyzing a specific classification of the web page according to a URL (Uniform Resource Locator) or contents of the web page; retrieving a browsing setting of the specific classification from a style-template database, wherein the style-template database records at least the browsing setting of each of a plurality of classifications; and viewing the web page according to the browsing setting.
Description
CROSS REFERENCE TO RELATED APPLICATIONS

This application claims priority of Taiwan Patent Application No. 099128792 filed on Aug. 27, 2010, the entirety of which is incorporated by reference herein.


BACKGROUND OF THE INVENTION

1. Field of the Invention


The disclosure generally relates to a method and a system for viewing a web page, and more particularly relates to a method and a system for automatically viewing a web page according to a URL (Uniform Resource Locator) or contents of the web page and according to a browsing setting.


2. Description of the Related Art


Recently, mobile devices, handheld devices in particularly, have become highly advanced and have more functions. For example, handheld devices may have functions for telecommunications, Internet access, e-mail access, advanced management of a list of addresses, or playing multimedia applications, etc. Due to convenience, these mobile devices are essential in human lives.


Nowadays, users often link to the Internet and view web pages via electronic devices. Generally speaking, some web sites have web pages in a fixed format. For example, a news web site may have all kinds of classifications, such as classifications for general news or financial news. Examples of the types of web sites may be forums, message boards, blogs, social networks, or news sites, etc.


Due to limited screen sizes of mobile devices, when viewing different web pages on mobile devices, users often need to change a zoom ratio or text reflow so as to read data in an appropriate form. It is well known that users may need to adjust the mobile device repeatedly so as to sustain good viewing page experience, which is inconvenient for users. For example, if a user wants to zoom in to news text of a web page, the viewer may be required to zoom in again once a different news text is viewed so as to sustain good viewing page experience, which is inconvenient for the user and takes a long time.


BRIEF SUMMARY OF THE INVENTION

In one exemplary embodiment, the disclosure is directed to a method for viewing web pages, for an electronic device, comprising the steps of: obtaining a web page; analyzing a specific classification of the web page according to a URL (Uniform Resource Locator) or contents of the web page; retrieving a browsing setting of the specific classification from a style-template database, wherein the style-template database records at least the browsing setting of each of a plurality of classifications; and viewing the web page according to the browsing setting.


In another exemplary embodiment, the disclosure is directed to a system for viewing web pages, for an electronic device, comprising: a storage unit, comprising a style-template database, wherein the style-template database records at least one browsing setting of each of a plurality of classifications; and a processor, obtaining a web page, analyzing a specific classification of the web page according to a URL (Uniform Resource Locator) or contents of the web page, retrieving the browsing setting of the specific classification from the style-template database, and viewing the web page according to the browsing setting.





BRIEF DESCRIPTION OF DRAWINGS

The invention can be more fully understood by reading the subsequent detailed description and examples with references made to the accompanying drawings, wherein:



FIG. 1 is a diagram for illustrating a system for viewing web pages according to an embodiment of the invention;



FIG. 2 is a diagram for illustrating the style-template database according to an embodiment of the invention;



FIG. 3 is a flowchart for illustrating a method for viewing web pages according to an embodiment of the invention;



FIG. 4 is a flowchart for illustrating a method for determining the specific classification of the web page according to an embodiment of the invention;



FIG. 5 is a flowchart for illustrating a method for determining the specific classification of the web page according to an embodiment of the invention; and



FIG. 6 is a flowchart for illustrating a method for determining the specific classification of the web page according to an embodiment of the invention.





DETAILED DESCRIPTION OF THE INVENTION


FIG. 1 is a diagram for illustrating a system 100 for viewing web pages according to an embodiment of the invention. The system 100 for viewing web pages may be applied to an electronic device, for example, a personal computer (PC), a personal digital assistance (PDA), a smart phone, a mobile phone, a mobile Internet device (MID), or a netbook.


The system 100 comprises a display unit 110, a storage unit 120, and a processor 130. The display unit is configured to display web pages, data, and/or images and interfaces. The storage unit 120 comprises a style-template database 121. FIG. 2 is a diagram for illustrating the style-template database 121 according to an embodiment of the invention. As shown in FIG. 2, the style-template database 121 may record a plurality of classifications, a pattern of each of the plurality of classifications, a DOM (Document Object Model), and a browsing setting. For example, the style-template database 121 in FIG. 2 records a pattern A1 of a classification A, a DOM A2, a browsing setting A3, a pattern B1 of a classification B, a DOM B2, and a browsing setting B3. It is noted that in some embodiments, the style-template database 121 merely records a browsing setting and either a pattern or a DOM. It is also noted that the DOM is an interface of a program in order to represent a document and establish communication between a web page and program codes. In some embodiments, the browsing settings A3, and B3 comprise a scrolling offset, a zoom level, a viewing block, whether to execute an application program (e.g., Flash or Script), and/or whether to reflow text. These settings will be illustrated in detail later. The storage unit 120 comprises data for display in the display unit 110. For example, the data may be a web page (not shown). It is noted that the system 100 may further comprise a network connection unit (not shown) for connecting to a network and reading/downloading a web page from a web site via the network. The processor 130 is configured to execute steps of a method for viewing web pages. All details will be illustrated as follows.



FIG. 3 is a flowchart for illustrating a method for viewing web pages according to an embodiment of the invention. The method for viewing web pages may be applied to an electronic device, for example, a personal computer (PC), a personal digital assistance (PDA), a smart phone, a mobile phone, a mobile Internet device (MID), or a netbook.


In step S310, a web page is obtained. It is noted that in some embodiments, the web page may be obtained from a web site via a network. In another embodiment, the web page may be stored in the storage unit 120 of the electronic device in advance. In step S320, a specific classification of the web page is analyzed according to a URL (Uniform Resource Locator) and/or contents of the web page (e.g., a DOM tree). It is noted that according to different demands and applications, the URL and the contents of the web page may be utilized for analyzing the specification classification of the web page independently or together. After the specific classification is obtained, in step S330, a browsing setting of the specific classification is retrieved from a style-template database. In step S340, the web page is viewed according to the browsing setting. It is noted that in some embodiments, the obtained browsing setting is utilized for setting a browser, which is utilized for viewing web pages. It is also noted that when a web page is viewed, the processor further makes a browsing adjustment of the web page and updates the browsing setting of the specific classification in the style-template database according to the browser adjustment. In another embodiment, if a user makes the browsing adjustment via the processor 130, the processor 130 may display a user interface through the display unit 110 so as to determine whether to update the browsing setting of the specific classification in the style-template database according to the browser adjustment. When the user confirms via the user interface, the browsing setting of the specific classification in the style-template database is updated according to the browser adjustment.



FIG. 4 is a flowchart for illustrating a method for determining the specific classification of the web page according to an embodiment of the invention. In the embodiment, the URL of the web page is utilized for analyzing the specific classification of the page.


In step S410, a URL of a web page is compared with a pattern of each of a plurality of classifications so as to obtain one or more candidate classifications matching the URL. In step S420, a similarity analysis is performed to compare the URL of the web page with the pattern of each of the one or more candidate classifications so as to obtain a similarity. It is noted that in some embodiments, the URL is compared with the pattern according to a regular expression. In other words, the pattern of each of the plurality of classifications may be set as a regular expression, and whether the URL of the web page matches the regular expression of each of the plurality of classification is determined. In another embodiment, the similarity analysis can be performed according to a common prefix portion and the other different portions. In step S430, whether the similarity between the URL and the pattern of each of the one or more candidate classifications is greater than a first threshold value is determined. If not, in step S440, a default classification is selected as a specific classification of the webpage. In other words, the web page is viewed according to a default browsing setting. If so, in step S450, one of the one or more candidate classifications is selected as the specific classification of the web page, wherein the selected one has the highest similarity. It is noted that if there is only one similarity between the URL and the pattern of only one of the one or more candidate classifications is greater than the first threshold value, the only one candidate classification is directly selected as the specific classification.



FIG. 5 is a flowchart for illustrating a method for determining the specific classification of the web page according to an embodiment of the invention. In the embodiment, the contents of the web page are utilized for analyzing the specific classification of the page.


In step S510, contents of a web page are obtained, such as a DOM tree. It is noted that the DOM tree is utilized for describing a structure of the web page. In some embodiments, the contents of the web page may be calculated so as to obtain the DOM tree. In another embodiment, the DOM tree of the web page may be obtained via a browser. In step S520, the DOM tree of the web page is compared with a DOM of each of a plurality of classifications so as to obtain one or more candidate classifications matching the DOM tree. It is noted that in some embodiments, the comparison between the DOM tree and the DOM may be made according to algorithms such as XML-Diff or HTML-Diff tools. In step S530, a similarity analysis is performed to compare the DOM tree with the DOM of each of the one or more candidate classifications so as to obtain a similarity. It is noted that in some embodiments, the foregoing similarity analysis may be performed according to a common sub-tree between the DOM tree and each DOM from a root node and according to a different left sub-tree between the DOM tree and each DOM. In step S540, whether the similarity is greater than a second threshold value is determined. If not, in step S550, a default classification is selected as a specific classification of the web page. In other words, the web page will be viewed according a default browsing setting. If so, in step S560, one of the one or more candidate classifications is selected as the specific classification, wherein the selected one has the highest similarity. If there is only one similarity between the DOM tree and the DOM of only one of the one or more candidate classifications is greater than the second threshold value, the only one candidate classification is directly selected as the specific classification.



FIG. 6 is a flowchart for illustrating a method for determining the specific classification of the web page according to an embodiment of the invention. In the embodiment, the URL and contents of the web page are both utilized for analyzing the specific classification of the page at the same time.


In step S610, a web page is obtained and a URL of the web page is compared with a pattern of each of a plurality of classifications so as to obtain one or more first candidate classifications matching the URL. In step S620, a similarity analysis is performed to compare the URL of the web page with the pattern of each of the one or more first candidate classifications so as to obtain a first similarity. Similarly, in some embodiments, the URL is compared with the pattern according to a regular expression. In other words, the pattern of each of the plurality of classifications may be set as a regular expression, and whether the URL of the web page matches the regular expression of each of the plurality of classification is determined. In another embodiment, the similarity analysis can be performed according to a common prefix portion and the other different portions. In step S630, whether the first similarity is greater than a first threshold is determined. If not, in step S680, a default classification is selected as a specific classification of the web page. In other words, the web page is viewed according to a default browsing setting. If so, in step S640, a DOM tree of the web page is obtained. Similarly, the contents of the web page may be calculated so as to obtain the DOM tree. In another embodiment, the DOM tree of the web page may be obtained via a browser. In step S650, the DOM tree of the web page with a DOM of each of the one or more first candidate classifications is compared so as to obtain one or more second candidate classifications matching the DOM tree. Similarly, in some embodiments, the comparison between the DOM tree and the DOM may be made according to algorithms such as XML-Diff or HTML-Diff tools. In step S660, a similarity analysis is performed to compare the DOM tree with the DOM of each of the one or more second candidate classifications so as to obtain a second similarity. Similarly, in some embodiments, the foregoing similarity analysis may be performed according to a common sub-tree between the DOM tree and each DOM from a root node and according to a different left sub-tree between the DOM tree and each DOM. In step S670, whether the second similarity is greater than a second threshold value is determined. If not, in step S680, a default classification is selected as a specific classification of the web page. If so, in step S690, one of the one or more second candidate classifications is selected as the specific classification of the web page, wherein the selected one has the highest second similarity. Similarly, if there is only one second similarity between the DOM tree and the DOM of only one of the one or more second candidate classifications is greater than the second threshold value, the only one candidate classification is directly selected as the specific classification. It is noted that in some embodiments, if only one of the one or more first candidate classifications has the first similarity greater than the first threshold, the steps S640-S690 may be removed, and the only one first candidate classification is directly selected as the specific classification of the web page.


It is noted that the foregoing methods for determining whether the URL or the contents of the web page match the pattern or the DOM of each of the plurality of classifications are just examples of the invention. The invention is not limited to the examples. Furthermore, it is noted that the foregoing methods for calculating the similarity between the URL/contents of the web page and the pattern/DOM of each of the plurality of classifications are just examples of the invention. The invention is also not limited to the examples.


As a result, through the methods and systems of the invention for viewing web pages, a web page can be viewed according to a URL or contents of the web page and according to different browser settings, so a user does not need to perform operations repeatedly when viewing other similar web pages. This is more convenient and efficient, and reduces consumption of resources in a computer system.


Setting methods for display parameters, or certain aspects or portions thereof, may take the form of a program code (i.e., executable instructions) embodied in tangible media, such as floppy diskettes, CD-ROMS, hard drives, or any other machine-readable storage medium, wherein, when the program code is loaded into and executed by a machine, such as a computer, the machine thereby becomes an apparatus for practicing the methods. The methods may also be embodied in the form of a program code transmitted over some transmission medium, such as electrical wiring or cabling, through fiber optics, or via any other form of transmission, wherein, when the program code is received and loaded into and executed by a machine, such as a computer, the machine becomes an apparatus for practicing the disclosed methods. When implemented on a general-purpose processor, the program code combines with the processor to provide a unique apparatus that operates analogously to application specific logic circuits.


It will be apparent to those skilled in the art that various modifications and variations can be made in the invention. It is intended that the standard and examples be considered as exemplary only, with a true scope of the disclosed embodiments being indicated by the following claims and their equivalents.

Claims
  • 1. A method for viewing web pages, for an electronic device, comprising the steps of: (a) obtaining a web page;(b) analyzing a specific classification of the web page according to a URL (Uniform Resource Locator) or contents of the web page;(c) retrieving a browsing setting of the specific classification from a style-template database, wherein the style-template database records at least the browsing setting of each of a plurality of classifications; and(d) viewing the web page according to the browsing setting.
  • 2. The method as claimed in claim 1, wherein the style-template database further records a pattern of each of the plurality of classifications, and the step (b) comprises the steps of: comparing the URL of the web page with the pattern of each of the plurality of classifications so as to obtain one or more candidate classifications matching the URL; andselecting the one or more candidate classifications as the specific classification of the web page.
  • 3. The method as claimed in claim 2, wherein the step (b) further comprises the steps of: performing a similarity analysis to compare the URL of the web page with the pattern of each of the one or more candidate classifications so as to obtain a similarity; andselecting one of the one or more candidate classifications as the specific classification of the web page, wherein the selected one has the highest similarity.
  • 4. The method as claimed in claim 1, wherein the style-template database further records a DOM (Document Object Model) of each of the plurality of classifications, and the step (b) comprises the steps of: obtaining a DOM tree of the web page;comparing the DOM tree of the web page with the DOM of each of the plurality of classifications so as to obtain one or more candidate classifications matching the DOM tree; andselecting the one or more candidate classifications as the specific classification of the web page.
  • 5. The method as claimed in claim 4, wherein, wherein the step (b) further comprises the steps of: performing a similarity analysis to compare the DOM tree of the web page with the DOM of each of the one or more candidate classifications so as to obtain a similarity; andselecting one of the one or more candidate classifications as the specific classification of the web page, wherein the selected one has the highest similarity.
  • 6. The method as claimed in claim 1, wherein the style-template database further records a pattern and a DOM (Document Object Model) of each of the plurality of classifications, and the step (b) comprises the steps of: comparing the URL of the web page with the pattern of each of the plurality of classifications so as to obtain a first similarity between the URL and the pattern of each of the plurality of classifications;obtaining a DOM tree of the web page;comparing the DOM tree with the DOM of each of one or more candidate classifications of the plurality of classifications so as to obtain a second similarity between the DOM tree and the DOM of each of the one or more candidate classifications, wherein each of the one or more candidate classifications has the first similarity that is greater than a threshold value; andselecting one of the one or more candidate classifications as the specific classification, wherein the selected one has the highest second similarity.
  • 7. A system for viewing web pages, for an electronic device, comprising: a storage unit, comprising a style-template database, wherein the style-template database records at least one browsing setting of each of a plurality of classifications; anda processor, obtaining a web page, analyzing a specific classification of the web page according to a URL (Uniform Resource Locator) or contents of the web page, retrieving the browsing setting of the specific classification from the style-template database, and viewing the web page according to the browsing setting.
  • 8. The system as claimed in claim 7, wherein the style-template database further records a pattern of each of the plurality of classifications, the processor further compares the URL of the web page with the pattern of each of the plurality of classifications so as to obtain one or more candidate classifications matching the URL, and the processor further selects the one or more candidate classifications as the specific classification of the web page.
  • 9. The system as claimed in claim 8, wherein the processor further performs a similarity analysis to compare the URL of the web page with the pattern of each of the one or more candidate classifications so as to obtain a similarity, and further selects one of the one or more candidate classifications as the specific classification of the web page, wherein the selected one has the highest similarity.
  • 10. The system as claimed in claim 9, wherein the style-template database further records a DOM (Document Object Model) of each of the plurality of classifications, and the processor further obtains a DOM tree of the web page, further compares the DOM tree of the web page with the DOM of each of the plurality of classifications so as to obtain one or more candidate classifications matching the DOM tree, and further selects the one or more candidate classifications as the specific classification of the web page.
  • 11. The system as claimed in claim 10, wherein the processor further performs a similarity analysis to compare the DOM tree of the web page with the DOM of each of the one or more candidate classifications so as to obtain a similarity, and further selects one of the one or more candidate classifications as the specific classification of the web page, wherein the selected one has the highest similarity.
  • 12. The system as claimed in claim 7, wherein the style-template database further records a pattern and a DOM (Document Object Model) of each of the plurality of classifications, and the processor further compares the URL of the web page with the pattern of each of the plurality of classifications so as to obtain a first similarity between the URL and the pattern of each of the plurality of classifications, further obtains a DOM tree of the web page, further compares the DOM tree with the DOM of each of one or more candidate classifications of the plurality of classifications so as to obtain a second similarity between the DOM tree and the DOM of each of the one or more candidate classifications, and further selects one of the one or more candidate classifications as the specific classification, wherein each of the one or more candidate classifications has the first similarity that is greater than a threshold value, and the selected one has the highest second similarity.
  • 13. The system as claimed in claim 7, wherein when the web page is viewed, the processor further makes a browsing adjustment of the web page and updates the browsing setting of the specific classification in the style-template database according to the browser adjustment.
  • 14. The system as claimed in claim 7, wherein the browsing setting comprises a scrolling offset, a zoom level, a viewing block, whether to execute an application program, and whether to reflow text.
Priority Claims (1)
Number Date Country Kind
99128792 Aug 2010 TW national