WO2016050124A1 - 网页转码方法、装置以及服务器 - Google Patents

网页转码方法、装置以及服务器 Download PDF

Info

Publication number
WO2016050124A1
WO2016050124A1 PCT/CN2015/087795 CN2015087795W WO2016050124A1 WO 2016050124 A1 WO2016050124 A1 WO 2016050124A1 CN 2015087795 W CN2015087795 W CN 2015087795W WO 2016050124 A1 WO2016050124 A1 WO 2016050124A1
Authority
WO
WIPO (PCT)
Prior art keywords
webpage
page
original
transcoding
server
Prior art date
Application number
PCT/CN2015/087795
Other languages
English (en)
French (fr)
Inventor
梁捷
周志明
Original Assignee
优视科技有限公司
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 优视科技有限公司 filed Critical 优视科技有限公司
Publication of WO2016050124A1 publication Critical patent/WO2016050124A1/zh

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor

Definitions

  • the present invention relates to the field of mobile internet technologies, and in particular, to a web page transcoding method, apparatus, and server.
  • transcoding server including compressing html, modifying Cascading Style Sheets (CSS), compressing pictures, etc.
  • the traditional transcoding process includes: first, obtaining the original web page html; second, parsing the document object model (Document Object Model, abbreviated as DOM) tree; third, executing JavaScript (referred to as JS); fourth, converting the DOM tree to output Html.
  • the transcoding server loads and parses the original web page, executes the JavaScript in the original web page, and then transcodes the original page.
  • the transcoded page does not support the original webpage, which requires JavaScript to be triggered by the user's click, which results in the lack of webpage functionality.
  • the technical problem mainly solved by the present invention is to provide a webpage transcoding method, device and server, which can Ensuring that the webpage functionality of the element that requires the user to click to execute the JavaScript is in normal use on the client.
  • a technical solution adopted by the present invention is: in a page after the first transcoding, when a user needs to click to execute an element of JavaScript, the webpage request including the webpage information sent by the browser is received.
  • the webpage information includes a location of the element in an original webpage of the page, a uniform resource locator of the original webpage, loading the original webpage according to the uniform resource locator, and according to the location Locating the element in the original webpage, and generating a click event on the element to execute a JavaScript to obtain a corresponding webpage, and transcoding the corresponding webpage a second time; sending the second transcoded page to The browser, so that the browser displays the second transcoded page.
  • the webpage information is generated by the server during the first transcoding of the original webpage, and when the user needs to click to execute the element of the JavaScript.
  • the position of the element in the original webpage is marked in an XPath language.
  • the element includes an element having an onclick attribute, or an element having an href attribute and beginning with "javascript:”.
  • another technical solution adopted by the present invention is to provide another webpage transcoding method, the method comprising: in a page after the first transcoding, when a user needs to click to execute an element of JavaScript When being clicked, sending a webpage request including webpage information to the server, wherein the webpage information includes a location of the element in an original webpage of the page, a uniform resource locator of the original webpage, and receiving the server a second transcoded page returned in response to the webpage request, wherein the second transcoded page is that the server loads the original webpage according to the uniform resource locator, and according to the Positioning the element in the original webpage, generating a click event on the element to execute a JavaScript to obtain a corresponding webpage, and transcoding the corresponding webpage; displaying the second transcoded page .
  • a server where the server includes: a receiving module, configured to perform a JavaScript on a page after the first transcoding.
  • the JavaScript obtains the corresponding webpage, and the corresponding webpage is transcoded a second time; the sending module is configured to send the second transcoded page to the browser, so that the browser displays the second revolving The page after the code.
  • the webpage information is generated by the server during the first transcoding of the original webpage, and when the user needs to click to execute the element of the JavaScript.
  • the position of the element in the original webpage is marked in an XPath language.
  • the element includes an element having an onclick attribute, or an element having an href attribute and beginning with "javascript:”.
  • a webpage transcoding device configured to: when the user wants to click on the page after the first transcoding When the element that executes the JavaScript is clicked, the webpage request including the webpage information is sent to the server, where the webpage information includes a location of the element in the original webpage of the page, and a uniform resource locator of the original webpage; a receiving module, configured to receive a second transcoded page returned by the server in response to the webpage request, where the second transcoded page is loaded by the server according to the uniform resource locator The original webpage, and positioning the element in the original webpage according to the location, generating a click event on the element to execute a JavaScript to obtain a corresponding webpage, and transcoding the corresponding webpage; the display module For displaying the page after the second transcoding.
  • a server including: a processor; a memory for storing executable instructions of the processor;
  • the memory is configured to store a computer execution instruction
  • the processor is configured to receive, in a page after the first transcoding, a webpage request that includes a webpage information sent by a browser, when the element that is required to be clicked by the user to execute the JavaScript is clicked, where the webpage information includes a location of the element in an original webpage of the page, a uniform resource locator of the original webpage; loading the original webpage according to the uniform resource locator, and locating the original webpage according to the location Deriving an element, and generating a click event on the element to execute a JavaScript to obtain a corresponding webpage, transcoding the corresponding webpage a second time; sending the second transcoded page to the browser, so that Browser display Show the page after the second transcoding.
  • the present invention further provides a terminal, including: a processor; a memory for storing processor executable instructions;
  • the memory is configured to store a computer execution instruction
  • the processor is configured to send, in a page after the first transcoding, a webpage request including webpage information to the server, when the element that the user clicks to execute the JavaScript is clicked, wherein the webpage information includes a location of the element in the original webpage of the page, a uniform resource locator of the original webpage, a second transcoded page returned by the server in response to the webpage request, wherein the second The sub-transcoded page is that the server loads the original webpage according to the uniform resource locator, and locates the element in the original webpage according to the location, generates a click event on the element to execute JavaScript Obtaining a corresponding webpage, and transcoding the corresponding webpage; displaying the page after the second transcoding.
  • the present invention also provides a non-transitory computer readable storage medium comprising computer executed instructions for execution of the computer executed instructions by a computer, the computer executing the first web page transcoding method.
  • the present invention also provides a non-transitory computer readable storage medium comprising computer executable instructions for execution by the processor of a computer to perform the aforementioned second web page transcoding method.
  • the present invention sends a webpage request including webpage information to the server when the user who clicks to execute the JavaScript element is clicked on the page after the first transcoding, wherein
  • the webpage information includes the location of the element in the original webpage of the page, the uniform resource locator of the original webpage of the page, the server receiving the webpage request of the browser, the original webpage of the loading page according to the uniform resource locator, and the original webpage according to the location.
  • FIG. 1 is a flowchart of an embodiment of a web page transcoding method of the present invention
  • FIG. 2 is a flow chart of another embodiment of a web page transcoding method of the present invention.
  • FIG. 3 is a schematic diagram showing a display effect of a specific webpage on a personal computer in the webpage transcoding method of the present invention
  • FIG. 4 is a schematic diagram showing a display effect of a specific webpage on a mobile phone after the first transcoding of the webpage transcoding method of the present invention
  • FIG. 5 is a schematic diagram showing a display effect on a mobile phone after a second transcoding of a specific webpage in the webpage transcoding method of the present invention
  • FIG. 6 is a schematic structural diagram of an embodiment of a server according to the present invention.
  • FIG. 7 is a schematic structural diagram of an embodiment of a web page transcoding apparatus according to the present invention.
  • FIG. 1 is a flowchart of an embodiment of a webpage transcoding method according to the present invention.
  • the embodiment is a flowchart of a server, and the method includes:
  • Step S101 In the page after the first transcoding, when an element that needs to be clicked by the user to execute JavaScript is clicked, receiving a webpage request including webpage information sent by the browser, where the webpage information includes an element on the original webpage of the page.
  • the location the Uniform Resource Locator (abbreviated as URL) of the original web page.
  • the original webpage refers to a webpage displayed on a personal computer.
  • the interface and style of the existing webpage are designed for the personal computer, and the original webpage is directly displayed on the mobile terminal of the client, and the display effect is not good, and the original webpage is transferred through the server. After the code is displayed on the mobile terminal, a better display effect can be obtained.
  • the transcoded page does not support the original webpage, which requires JavaScript to be triggered by the user's click, which results in the lack of webpage functionality.
  • the browser sends a webpage request including webpage information to the server when the element is clicked on the page after the first transcoding, wherein the webpage information includes an element.
  • the webpage information includes an element.
  • the element includes but is not limited to: an element having an onclick attribute, or an element having an href attribute and beginning with "javascript:”.
  • the webpage information is generated by the server during the first transcoding of the original webpage, and when the user needs to click to execute the element of the JavaScript. That is, when the server performs the first transcoding of the original webpage, if an element that requires the user to click to execute the JavaScript is detected, the webpage information is generated, and the webpage information includes the position of the element in the original webpage of the page, and the original of the page. The uniform resource locator of the web page. When the server sends the first transcoded page to the browser, the web page information is also carried.
  • Step S102 The original webpage of the page is loaded according to the uniform resource locator, and the element is located in the original webpage according to the location, and a click event of the element is generated to execute the JavaScript to obtain the corresponding webpage, and the corresponding webpage is transcoded a second time.
  • the server receives the webpage request of the browser, and the webpage request includes the webpage information, where the webpage information includes the location of the element in the original webpage of the page, and the uniform resource locator of the original webpage of the page.
  • a Uniform Resource Locator is a compact representation of the location and access methods of resources available on the Internet. It is the address of a standard resource on the Internet. Each file on the Internet has a unique URL that contains information. Point out where the file is and what the browser should do with it.
  • the server loads the original webpage of the page according to the uniform resource locator, and locates the element in the original webpage according to the location, and generates a click event on the element to execute the JavaScript to obtain the corresponding webpage, and the corresponding webpage is transcoded a second time.
  • the method includes the following steps: (1) reloading the original webpage according to the uniform resource locator; (2) locating the element in the original webpage according to the location, and sending a click operation to the DOM node corresponding to the element.
  • the Document Object Model (DOM) is a standard programming interface recommended by the W3C organization for handling extensible markup languages. It is a platform- and language-independent application programming interface (API) that can be dynamically accessed.
  • DOM is divided into HTML DOM and XML DOM; they define standard methods for accessing and manipulating HTML/XML documents, and present corresponding documents with Tree structure of elements, attributes, and text (node tree).
  • the Html standard stipulates that if a click event is sent to a node, the JavaScript code defined by the onclick or href attribute is triggered, and the JavaScript code is executed to form a second transcoded web page.
  • XPath is a markup language for finding information in an Extensible Markup Language (XML) document for navigating through elements and attributes in an XML document.
  • XML Extensible Markup Language
  • the location of the elements in the original web page can also be marked with other markup languages, such as standard universal markup language, hypertext markup language, extensible hypertext markup language, and the like.
  • Step S103 Send the page after the second transcoding to the browser, so that the browser displays the page after the second transcoding.
  • the server receives a webpage request including webpage information sent by the browser in the page after the first transcoding, in which the user clicks to execute the element of the JavaScript, and the webpage information includes the element in the original webpage of the page.
  • Location the uniform resource locator of the original page of the page; loading the original webpage of the page according to the uniform resource locator, and locating the element in the original webpage according to the location, and generating a click event on the element to execute the JavaScript to obtain the corresponding webpage, and the corresponding webpage
  • Perform a second transcoding send the second transcoded page to the browser so that the browser displays the second transcoded page.
  • FIG. 2 is a flowchart of another embodiment of a webpage transcoding method according to the present invention.
  • the embodiment is a flowchart of a client, and the method includes:
  • Step S201 In the page after the first transcoding, when the element that needs to be clicked by the user to execute the JavaScript is clicked, the webpage request including the webpage information is sent to the server, where the webpage information includes the element in the original webpage of the page. The location, the uniform resource locator of the original page.
  • the original webpage refers to a webpage displayed on a personal computer.
  • the interface and style of the existing webpage are designed for the personal computer, and the original webpage is directly displayed on the mobile terminal of the client, and the display effect is not good, and the original webpage is transferred through the server. After the code is displayed on the mobile terminal, a better display effect can be obtained.
  • the transcoded page does not support the original
  • the start page has some JavaScript that needs to be triggered by the user to click, which causes the lack of webpage functionality.
  • the browser sends a webpage request including webpage information to the server, wherein the webpage information includes an element.
  • the webpage information includes an element.
  • the element includes but is not limited to: an element having an onclick attribute, or an element having an href attribute and beginning with "javascript:”.
  • the webpage information is generated by the server during the first transcoding of the original webpage, and when the user needs to click to execute the element of the JavaScript. That is, when the server performs the first transcoding of the original webpage, if an element that requires the user to click to execute the JavaScript is detected, the webpage information is generated, and the webpage information includes the position of the element in the original webpage of the page, and the original of the page. The uniform resource locator of the web page. When the server sends the first transcoded page to the browser, the web page information is also carried. When an element is clicked, a web page request including web page information may be generated first.
  • Step S202 Receive a second transcoded page returned by the server in response to the webpage request, where the second transcoded page is the original webpage that the server loads the page according to the uniform resource locator, and is located in the original webpage according to the location. Positioning elements, generating click events on the elements to execute JavaScript to get the corresponding web pages, and transcoding the corresponding web pages.
  • a Uniform Resource Locator is a compact representation of the location and access methods of resources available on the Internet. It is the address of a standard resource on the Internet. Each file on the Internet has a unique URL that contains information. Point out where the file is and what the browser should do with it.
  • the webpage information includes the location of the element in the original webpage of the page, the uniform resource locator of the original webpage of the page, and the server loads according to the uniform resource locator.
  • the server returns the second transcoded page to the browser, so the browser receives the second transcoded page returned by the server in response to the webpage request.
  • XPath is a markup language for finding information in extensible markup language documents for navigating through elements and attributes in an XML document.
  • the location of the elements in the original web page can also be marked with other markup languages, such as standard universal markup language, hypertext markup language, extensible hypertext markup language, and the like.
  • Step S203 Display the page after the second transcoding.
  • the browser when the element that needs to be clicked by the user to execute JavaScript is clicked on the page after the first transcoding, the browser sends a webpage request including the webpage information to the server, where the webpage information includes the element in the original webpage of the page.
  • the webpage http://tool.xdf.cn/xhy/result_xinzitoushangyibadao.html
  • the display effect of the webpage on the personal computer is as shown in Fig. 3
  • the first transcoding is suitable for the display of the mobile phone (client).
  • the server receives a web page request from the mobile browser:
  • the bold part is the server and port; the underlined part is the original web page address (ie http://tool.xdf.cn/xhy/result_xinzitoushangyibadao.html); the bold and underlined parts are the elements that need to be clicked by the user.
  • the server reproduces the original webpage, then locates the element that the user needs to click according to Xpath, sends a click event to it, triggers JavaScript execution, and then transcodes the second time.
  • the browser redisplays the page after the second transcoding, and the result is shown in Figure 5.
  • the webpage transcoding method provided by the invention can correctly display the answer by requesting the server, after the server reloads the page, executes the click event, and transcodes the output.
  • FIG. 6 is a schematic structural diagram of an embodiment of a server according to the present invention.
  • the server includes: a receiving module 101, an executing module 102, and a sending module 103.
  • the receiving module 101 is configured to receive, in a page after the first transcoding, a webpage request that includes a webpage information sent by the browser, when the element that is required to be clicked by the user to execute the JavaScript is clicked, where the webpage information includes the element on the page.
  • the original webpage refers to a webpage displayed on a personal computer.
  • the interface and style of the existing webpage are designed for the personal computer, and the original webpage is directly displayed on the mobile terminal of the client, and the display effect is difficult to see, and the original webpage is turned by the server. After the code is displayed on the mobile terminal, a better display effect can be obtained.
  • the transcoded page does not support the original webpage, which requires JavaScript to be triggered by the user's click, which results in the lack of webpage functionality.
  • the browser sends a webpage request including webpage information to the server when the element is clicked on the page after the first transcoding, wherein the webpage information includes an element.
  • the webpage information includes an element.
  • the element includes but is not limited to: an element having an onclick attribute, or an element having an href attribute and beginning with "javascript:”.
  • the webpage information is generated by the server during the first transcoding of the original webpage, and when the user needs to click to execute the element of the JavaScript. That is, when the server performs the first transcoding of the original webpage, if an element that requires the user to click to execute the JavaScript is detected, the webpage information is generated, and the webpage information includes the position of the element in the original webpage of the page, and the original of the page.
  • the uniform resource locator of the web page When the server sends the first transcoded page to the browser, it also carries the Web page information.
  • the execution module 102 is configured to load the original webpage of the page according to the uniform resource locator, and locate the element in the original webpage according to the location, and generate a click event on the element to execute the JavaScript to obtain the corresponding webpage, and perform the second transcoding on the corresponding webpage.
  • the server receives the webpage request of the browser, and the webpage request includes the webpage information, where the webpage information includes the location of the element in the original webpage of the page, and the uniform resource locator of the original webpage of the page.
  • a Uniform Resource Locator is a compact representation of the location and access methods of resources available on the Internet. It is the address of a standard resource on the Internet. Each file on the Internet has a unique URL that contains information. Point out where the file is and what the browser should do with it.
  • XPath is a markup language for finding information in extensible markup language documents for navigating through elements and attributes in an XML document.
  • the location of the elements in the original web page can also be marked with other markup languages, such as standard universal markup language, hypertext markup language, extensible hypertext markup language, and the like.
  • the sending module 103 is configured to send the second transcoded page to the browser, so that the browser displays the second transcoded page.
  • the server receives a webpage request including webpage information sent by the browser in the page after the first transcoding, in which the user clicks to execute the element of the JavaScript, and the webpage information includes the element in the original webpage of the page.
  • Location the uniform resource locator of the original page of the page; loading the original webpage of the page according to the uniform resource locator, and locating the element in the original webpage according to the location, and generating a click event on the element to execute the JavaScript to obtain the corresponding webpage, and the corresponding webpage
  • Perform a second transcoding send the second transcoded page to the browser so that the browser displays the second transcoded page.
  • FIG. 7 is a schematic structural diagram of an embodiment of a webpage transcoding device according to the present invention.
  • the device includes a sending module 201, a receiving module 202, and a display module 203.
  • the sending module 201 is configured to send, in the page after the first transcoding, a webpage request including webpage information, where the element is required to be clicked to execute an element of the JavaScript, wherein the webpage information includes an element in the original page.
  • the original webpage refers to a webpage displayed on a personal computer.
  • the interface and style of the existing webpage are designed for the personal computer, and the original webpage is directly displayed on the mobile terminal of the client, and the display effect is not good, and the original webpage is transferred through the server. After the code is displayed on the mobile terminal, a better display effect can be obtained.
  • the transcoded page does not support the original webpage, which requires JavaScript to be triggered by the user's click, which results in the lack of webpage functionality.
  • the browser sends a webpage request including webpage information to the server, wherein the webpage information includes an element.
  • the webpage information includes an element.
  • the element includes but is not limited to: an element having an onclick attribute, or an element having an href attribute and beginning with "javascript:”.
  • the webpage information is generated by the server during the first transcoding of the original webpage, and when the user needs to click to execute the element of the JavaScript. That is, when the server performs the first transcoding of the original webpage, if an element that requires the user to click to execute the JavaScript is detected, the webpage information is generated, and the webpage information includes the position of the element in the original webpage of the page, and the original of the page. The uniform resource locator of the web page. When the server sends the first transcoded page to the browser, the web page information is also carried.
  • the receiving module 202 is configured to receive a second transcoded page returned by the server in response to the webpage request, where the second transcoded page is the server loading the original webpage according to the uniform resource locator, and the original webpage according to the location Positioning elements, generating click events on the elements to execute JavaScript to get the corresponding web pages, and transcoding the corresponding web pages.
  • Uniform Resource Locator is a kind of location and access method for resources that can be obtained from the Internet.
  • the concise representation is the address of the standard resource on the Internet. Every file on the Internet has a unique URL that contains information indicating the location of the file and how the browser should handle it.
  • the webpage information includes the location of the element in the original webpage of the page, the uniform resource locator of the original webpage of the page, and the server loads according to the uniform resource locator.
  • the server returns the second transcoded page to the browser, so the browser receives the second transcoded page returned by the server in response to the webpage request.
  • XPath is a markup language for finding information in extensible markup language documents for navigating through elements and attributes in an XML document.
  • the location of the elements in the original web page can also be marked with other markup languages, such as standard universal markup language, hypertext markup language, extensible hypertext markup language, and the like.
  • the display module 203 is configured to display the page after the second transcoding.
  • the browser when the element that needs to be clicked by the user to execute JavaScript is clicked on the page after the first transcoding, the browser sends a webpage request including the webpage information to the server, where the webpage information includes the element in the original webpage of the page.
  • the present invention also provides a server, including: a processor; a memory for storing processor-executable instructions;
  • a memory for storing computer execution instructions
  • a processor configured to receive, in a page after the first transcoding, a webpage request including a webpage information sent by a browser, when the element that is required to click to execute the JavaScript is clicked, wherein the webpage information includes an element on the page The location in the original page, the uniform resource locator of the original page; the original resource locator is loaded according to the uniform resource locator Starting the webpage, and locating the element in the original webpage according to the location, and generating a click event on the element to execute the JavaScript to obtain the corresponding webpage, and translating the corresponding webpage for the second time; sending the second transcoded page to the browser So that the browser displays the page after the second transcode.
  • the present invention also provides a terminal, including: a processor; a memory for storing processor-executable instructions;
  • a memory for storing computer execution instructions
  • a processor configured to send, in a page after the first transcoding, a webpage request including webpage information to the server when an element that the user clicks to execute the JavaScript is clicked, wherein the webpage information includes an element in the original page The location in the webpage, the uniform resource locator of the original webpage; the second transcoded page returned by the server in response to the webpage request, wherein the second transcoded page is the server loading the original webpage according to the uniform resource locator And positioning the element in the original webpage according to the location, generating a click event on the element to execute the JavaScript to obtain the corresponding webpage, and transcoding the corresponding webpage; displaying the page after the second transcoding.
  • the present invention also provides a non-transitory computer readable storage medium comprising computer executed instructions for execution of the web page transcoding shown in FIG. 1 when the processor of the computer executes the computer executable instructions method.
  • the present invention also provides a non-transitory computer readable storage medium comprising computer executed instructions for execution of the web page transcoding shown in FIG. 2 when a processor of a computer executes the computer executable instructions method.

Landscapes

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

Abstract

本发明公开了一种网页转码方法、装置以及服务器,该方法包括:接收浏览器在第一次转码后的页面中需用户点击以执行JavaScript的元素被点击时,发送的包括网页信息的网页请求,其中,网页信息包括元素在页面的原始网页中的位置、页面的原始网页的统一资源定位符;根据统一资源定位符加载页面的原始网页,以及根据位置在原始网页中定位元素,并产生对元素的点击事件以执行JavaScript得到对应网页,将对应网页进行第二次转码;将第二次转码后的页面发送给浏览器,以便浏览器显示第二次转码后的页面。通过上述方式,本发明能够保证需要用户点击以执行JavaScript的元素的网页功能在客户端的正常使用。

Description

网页转码方法、装置以及服务器
本发明要求于2014年9月30日提交中国专利局、申请号为201410522095.3、发明名称为“网页转码方法、装置以及服务器”的中国专利申请的优先权,其全部内容通过引用结合在本发明中。
技术领域
本发明涉及移动互联网技术领域,特别是涉及一种网页转码方法、装置以及服务器。
背景技术
移动互联网的兴起,使手机用户逐渐形成用手机访问互联网的习惯。但由于传统互联WEB网站的界面和风格,是为个人计算机屏幕设计的,即使手机上安装了可阅读的超级文本标记语言(HyperText Markup Language,简写为HTML)格式网页的浏览器,这些网页(即原始网页)在手机屏幕上显示的效果仍然很难看。
现有技术中,将这些原始网页通过转码服务器进行转码(包括压缩html、修改级联样式表(Cascading Style Sheets,简写为CSS)、压缩图片等手段)后,可以在手机上有更好的浏览效果,并且节省流量。传统转码流程包括:第一,获取原始网页html;第二,解析文档对象模型(Document Object Model,简写为DOM)树;第三,执行JavaScript(简称JS);第四,将DOM树转换输出html。转码服务器加载和解析原始网页,执行原始网页中的JavaScript,然后把原始页面转码输出。
但是,由于原始网页转码后html代码和结构发生较大变化,转码页面不支持原始网页一些需要用户点击才被触发的JavaScript,这造成网页功能的缺失。
发明内容
本发明主要解决的技术问题是提供一种网页转码方法、装置以及服务器,能 够保证需要用户点击以执行JavaScript的元素的网页功能在客户端的正常使用。
为解决上述技术问题,本发明采用的一个技术方案是:在第一次转码后的页面中,当需用户点击以执行JavaScript的元素被点击时,接收浏览器发送的包括网页信息的网页请求,其中,所述网页信息包括所述元素在所述页面的原始网页中的位置、所述原始网页的统一资源定位符;根据所述统一资源定位符加载所述原始网页,以及根据所述位置在所述原始网页中定位所述元素,并产生对所述元素的点击事件以执行JavaScript得到对应网页,将所述对应网页进行第二次转码;将第二次转码后的页面发送给所述浏览器,以便所述浏览器显示所述第二次转码后的页面。
其中,所述网页信息是服务器在对所述原始网页进行第一次转码的过程中,监测到需要用户点击以执行JavaScript的元素时生成的。
其中,所述元素在所述原始网页中的位置以XPath语言标记。
其中,所述元素包括具有onclick属性的元素、或具有href属性且以“javascript:”开头的元素。
为解决上述技术问题,本发明采用的另一个技术方案是:提供另一种网页转码方法,所述方法包括:在第一次转码后的页面中,当需用户点击以执行JavaScript的元素被点击时,则向服务器发送包括网页信息的网页请求,其中,所述网页信息包括所述元素在所述页面的原始网页中的位置、所述原始网页的统一资源定位符;接收所述服务器响应所述网页请求而返回的第二次转码后的页面,其中,所述第二次转码后的页面是所述服务器根据所述统一资源定位符加载所述原始网页,以及根据所述位置在所述原始网页中定位所述元素,产生对所述元素的点击事件以执行JavaScript得到对应网页,以及将所述对应网页进行转码得到的;显示所述第二次转码后的页面。
为解决上述技术问题,本发明采用的又一个技术方案是:提供一种服务器,所述服务器包括:接收模块,用于在第一次转码后的页面中,当需用户点击以执行JavaScript的元素被点击时,接收浏览器发送的包括网页信息的网页请求,其中,所述网页信息包括所述元素在所述页面的原始网页中的位置、所述原始网页的统 一资源定位符;执行模块,用于根据所述统一资源定位符加载所述原始网页,以及根据所述位置在所述原始网页中定位所述元素,并产生对所述元素的点击事件以执行JavaScript得到对应网页,将所述对应网页进行第二次转码;发送模块,用于将第二次转码后的页面发送给所述浏览器,以便所述浏览器显示所述第二次转码后的页面。
其中,所述网页信息是服务器在对所述原始网页进行第一次转码的过程中,监测到需要用户点击以执行JavaScript的元素时生成的。
其中,所述元素在所述原始网页中的位置以XPath语言标记。
其中,所述元素包括具有onclick属性的元素、或具有href属性且以“javascript:”开头的元素。
为解决上述技术问题,本发明采用的又一个技术方案是:提供一种网页转码装置,所述装置包括:发送模块,用于在第一次转码后的页面中,当需用户点击以执行JavaScript的元素被点击时,则向服务器发送包括网页信息的网页请求,其中,所述网页信息包括所述元素在所述页面的原始网页中的位置、所述原始网页的统一资源定位符;接收模块,用于接收所述服务器响应所述网页请求而返回的第二次转码后的页面,其中,所述第二次转码后的页面是所述服务器根据所述统一资源定位符加载所述原始网页,以及根据所述位置在所述原始网页中定位所述元素,产生对所述元素的点击事件以执行JavaScript得到对应网页,以及将所述对应网页进行转码得到的;显示模块,用于显示所述第二次转码后的页面。
为解决上述技术问题,本发明采用的又一个技术方案是:提供一种服务器,包括:处理器;用于存储处理器可执行指令的存储器;
所述存储器,用于存储计算机执行指令;
所述处理器,用于在第一次转码后的页面中,当需用户点击以执行JavaScript的元素被点击时,接收浏览器发送的包括网页信息的网页请求,其中,所述网页信息包括所述元素在所述页面的原始网页中的位置、所述原始网页的统一资源定位符;根据所述统一资源定位符加载所述原始网页,以及根据所述位置在所述原始网页中定位所述元素,并产生对所述元素的点击事件以执行JavaScript得到对应网页,将所述对应网页进行第二次转码;将第二次转码后的页面发送给所述浏览器,以便所述浏览器显 示所述第二次转码后的页面。
为解决上述技术问题,本发明还提供一种终端,包括:处理器;用于存储处理器可执行指令的存储器;
所述存储器,用于存储计算机执行指令;
所述处理器,用于在第一次转码后的页面中,当需用户点击以执行JavaScript的元素被点击时,则向服务器发送包括网页信息的网页请求,其中,所述网页信息包括所述元素在所述页面的原始网页中的位置、所述原始网页的统一资源定位符;接收所述服务器响应所述网页请求而返回的第二次转码后的页面,其中,所述第二次转码后的页面是所述服务器根据所述统一资源定位符加载所述原始网页,以及根据所述位置在所述原始网页中定位所述元素,产生对所述元素的点击事件以执行JavaScript得到对应网页,以及将所述对应网页进行转码得到的;显示所述第二次转码后的页面。
相应地,本发明还提供一种非临时性计算机可读存储介质,包括计算机执行指令,以供计算机的处理器执行所述计算机执行指令时,所述计算机执行前述第一种网页转码方法。
相应地,本发明还提供一种非临时性计算机可读存储介质,包括计算机执行指令,以供计算机的处理器执行所述计算机执行指令时,所述计算机执行前述第二种网页转码方法。
本发明的有益效果是:区别于现有技术的情况,本发明当第一次转码后的页面中需用户点击以执行JavaScript的元素被点击,则向服务器发送包括网页信息的网页请求,其中,网页信息包括元素在页面的原始网页中的位置、页面的原始网页的统一资源定位符;服务器接收浏览器的网页请求;根据统一资源定位符加载页面的原始网页,以及根据位置在原始网页中定位元素,并产生对元素的点击事件以执行JavaScript得到对应网页,将对应网页进行第二次转码;将第二次转码后的页面发送给浏览器;接收服务器响应网页请求而返回的第二次转码后的页面;显示第二次转码后的页面。通过这种方式,能够保证需要用户点击以执行JavaScript的元素的网页功能在客户端的正常使用。
附图说明
图1是本发明网页转码方法一实施方式的流程图;
图2是本发明网页转码方法另一实施方式的流程图;
图3是本发明网页转码方法中一个具体的网页在个人计算机上的显示效果示意图;
图4是本发明网页转码方法中一个具体的网页第一次转码后在手机上的显示效果示意图;
图5是本发明网页转码方法中一个具体的网页第二次转码后在手机上的显示效果示意图;
图6是本发明服务器一实施方式的结构示意图;
图7是本发明网页转码装置一实施方式的结构示意图。
具体实施方式
下面结合附图和实施方式对本发明进行详细说明。
参阅图1,图1是本发明网页转码方法一实施方式的流程图,本实施方式是服务器端的流程图,该方法包括:
步骤S101:在第一次转码后的页面中,当需用户点击以执行JavaScript的元素被点击时,接收浏览器发送的包括网页信息的网页请求,其中,网页信息包括元素在页面的原始网页中的位置、原始网页的统一资源定位符(Uniform Resource Locator,简写为URL)。
原始网页是指在个人计算机上显示的网页,现有网页的界面和风格是为个人计算机设计的,将这些原始网页直接在客户端的移动终端上显示,显示效果不好,通过服务器将原始网页转码后,在移动终端上显示,可以获得较好的显示效果。但是,由于原始网页转码后html代码和结构发生较大变化,转码页面不支持原始网页一些需要用户点击才被触发的JavaScript,这造成网页功能的缺失。
为了保证需要用户点击以执行JavaScript的元素的网页功能正常使用,浏览器在第一次转码后的页面中该元素被点击时,向服务器发送包括网页信息的网页请求,其中,网页信息包括元素在页面的原始网页中的位置、页面的原始网页 的统一资源定位符。
其中,该元素包括但不限于:具有onclick属性的元素、或具有href属性且以“javascript:”开头的元素。
其中,网页信息是服务器在对原始网页进行第一次转码的过程中,监测到需要用户点击以执行JavaScript的元素时生成的。即当服务器在对原始网页进行第一次转码的时候,如果监测到需要用户点击以执行JavaScript的元素,则生成网页信息,该网页信息包括元素在页面的原始网页中的位置、页面的原始网页的统一资源定位符。当服务器将第一次转码后的页面发送给浏览器时,也携带该网页信息。
步骤S102:根据统一资源定位符加载页面的原始网页,以及根据位置在原始网页中定位元素,并产生对元素的点击事件以执行JavaScript得到对应网页,将对应网页进行第二次转码。
服务器接收到浏览器的网页请求,网页请求中包括网页信息的,网页信息包括元素在页面的原始网页中的位置、页面的原始网页的统一资源定位符。
统一资源定位符是对可以从互联网上得到的资源的位置和访问方法的一种简洁的表示,是互联网上标准资源的地址,互联网上的每个文件都有一个唯一的URL,它包含的信息指出文件的位置以及浏览器应该怎么处理它。
服务器根据统一资源定位符加载页面的原始网页,以及根据位置在原始网页中定位元素,并产生对元素的点击事件以执行JavaScript得到对应网页,将对应网页进行第二次转码。在实际应用中,具体包括如下过程:(1)根据统一资源定位符,重新加载原始网页;(2)根据位置在原始网页中定位元素,向元素所对应的DOM节点发送点击操作。文档对象模型(Document Object Model,简写为DOM),是W3C组织推荐的处理可扩展置标语言的标准编程接口,它是一种与平台和语言无关的应用程序接口(API),可以动态地访问程序和脚本,更新其内容、结构和www文档的风格;DOM分为HTML DOM和XML DOM两种;它们分别定义了访问和操作HTML/XML文档的标准方法,并将对应的文档呈现为带有元素、属性和文本的树结构(节点树)。(3)执行元素的JavaScript,形成第二次转 码后的页面。Html标准规定如果向节点发送点击事件,会触发onclick或href属性定义的JavaScript代码,执行该JavaScript代码,从而形成第二次转码后的网页页面。
其中,元素在原始网页中的位置以XPath语言标记。
XPath是一门在可扩展标记语言(Extensible Markup Language,简写为XML)文档中查找信息的标记语言,用于在XML文档中通过元素和属性进行导航。当然,元素在原始网页中的位置还可以是用其它的标记语言进行标记的,例如:标准通用置标语言、超文本标记语言、可延伸超文件标记语言等等。
步骤S103:将第二次转码后的页面发送给浏览器,以便浏览器显示第二次转码后的页面。
本发明实施方式服务器接收浏览器在第一次转码后的页面中需用户点击以执行JavaScript的元素被点击时,发送的包括网页信息的网页请求,网页信息包括元素在页面的原始网页中的位置、页面的原始网页的统一资源定位符;根据统一资源定位符加载页面的原始网页,以及根据位置在原始网页中定位元素,并产生对元素的点击事件以执行JavaScript得到对应网页,将对应网页进行第二次转码;将第二次转码后的页面发送给浏览器,以便浏览器显示第二次转码后的页面。通过这种方式,能够保证需要用户点击以执行JavaScript的元素的网页功能在客户端的正常使用。
参阅图2,图2是本发明网页转码方法另一实施方式的流程图,本实施方式是客户端的流程图,该方法包括:
步骤S201:在第一次转码后的页面中,当需用户点击以执行JavaScript的元素被点击时,则向服务器发送包括网页信息的网页请求,其中,网页信息包括元素在页面的原始网页中的位置、原始网页的统一资源定位符。
原始网页是指在个人计算机上显示的网页,现有网页的界面和风格是为个人计算机设计的,将这些原始网页直接在客户端的移动终端上显示,显示效果不好,通过服务器将原始网页转码后,在移动终端上显示,可以获得较好的显示效果。但是,由于原始网页转码后html代码和结构发生较大变化,转码页面不支持原 始网页一些需要用户点击才被触发的JavaScript,这造成网页功能的缺失。
为了保证需要用户点击以执行JavaScript的元素的网页功能正常使用,在第一次转码后的页面中该元素被点击时,浏览器向服务器发送包括网页信息的网页请求,其中,网页信息包括元素在页面的原始网页中的位置、页面的原始网页的统一资源定位符。
其中,该元素包括但不限于:具有onclick属性的元素、或具有href属性且以“javascript:”开头的元素。
其中,网页信息是服务器在对原始网页进行第一次转码的过程中,监测到需要用户点击以执行JavaScript的元素时生成的。即当服务器在对原始网页进行第一次转码的时候,如果监测到需要用户点击以执行JavaScript的元素,则生成网页信息,该网页信息包括元素在页面的原始网页中的位置、页面的原始网页的统一资源定位符。当服务器将第一次转码后的页面发送给浏览器时,也携带该网页信息。当元素被点击时,可以首先生成包括网页信息的网页请求。
步骤S202:接收服务器响应网页请求而返回的第二次转码后的页面,其中,第二次转码后的页面是服务器根据统一资源定位符加载页面的原始网页,以及根据位置在原始网页中定位元素,产生对元素的点击事件以执行JavaScript得到对应网页,以及将对应网页进行转码得到的。
统一资源定位符是对可以从互联网上得到的资源的位置和访问方法的一种简洁的表示,是互联网上标准资源的地址,互联网上的每个文件都有一个唯一的URL,它包含的信息指出文件的位置以及浏览器应该怎么处理它。
当服务器接收到浏览器发送的网页请求后,由于网页请求中包括网页信息,网页信息包括元素在页面的原始网页中的位置、页面的原始网页的统一资源定位符,服务器根据统一资源定位符加载页面的原始网页,以及根据位置在原始网页中定位元素,并产生对元素的点击事件以执行JavaScript得到对应网页,将对应网页进行第二次转码。然后,服务器将第二次转码后的页面返回给浏览器,因此,浏览器接收服务器响应网页请求而返回的第二次转码后的页面。
其中,元素在原始网页中的位置以XPath语言标记。
XPath是一门在可扩展标记语言文档中查找信息的标记语言,用于在XML文档中通过元素和属性进行导航。当然,元素在原始网页中的位置还可以是用其它的标记语言进行标记的,例如:标准通用置标语言、超文本标记语言、可延伸超文件标记语言等等。
步骤S203:显示第二次转码后的页面。
本发明实施方式当第一次转码后的页面中需用户点击以执行JavaScript的元素被点击,则浏览器向服务器发送包括网页信息的网页请求,其中,网页信息包括元素在页面的原始网页中的位置、页面的原始网页的统一资源定位符;接收服务器响应网页请求而返回的第二次转码后的页面,其中,第二次转码后的页面是服务器根据统一资源定位符加载页面的原始网页,以及根据位置在原始网页中定位元素,产生对元素的点击事件以执行JavaScript得到对应网页,以及将对应网页进行转码得到的;显示第二次转码后的页面。通过这种方式,能够保证需要用户点击以执行JavaScript的元素的网页功能在客户端的正常使用。
下面以一个具体的例子来说明本发明方法的实施效果。
比如网页:http://tool.xdf.cn/xhy/result_xinzitoushangyibadao.html,该网页在个人计算机上的显示效果如图3所示,第一次转码为适合手机(客户端)显示的效果如图4所示,当用户点击查看答案时,服务器收到来自手机浏览器的网页请求:
http://10.1.45.123:16747/?src=http%3A%2F%2Ftool.xdf.cn%2Fxhy%2Fre sult_xinzitoushangyibadao.html&clicks=%2F%2Fa%5B%40class%3Danswer%5D
在该网页请求中,粗体部分是服务器和端口;下划线部分是原始网页地址(即http://tool.xdf.cn/xhy/result_xinzitoushangyibadao.html);粗体和下划线部分是需要用户点击的元素的Xpath位置(即//a[@class='answer'])。
根据上述网页请求,服务器重现加载原始网页,然后根据Xpath定位需要用户点击的元素,向其发送点击事件,触发JavaScript执行,然后第二次转码输出。浏览器重新显示第二次转码后的网页页面,显示结果如图5所示。
现有技术中,通过现有的转码技术转码后,可以获得图4所示的页面,但是, 当用户点击“查看答案”时,不能显示答案,即不能获得图5所示的页面。例如:通过百度转码的页面:
http://gate.baidu.com/tc?bd_page_type=1&src=http%3A%2F%2Ftool.xdf.cn%2Fxhy%2Fresult_xinzitoushangyibadao.html,也是显示不了答案。
本发明提供的网页转码方法,通过请求服务器,在服务器重新加载页面、执行点击事件,并转码输出后,浏览器可以正确显示答案。
参阅图6,图6是本发明服务器一实施方式的结构示意图,该服务器包括:接收模块101、执行模块102以及发送模块103。
接收模块101用于在第一次转码后的页面中,当需用户点击以执行JavaScript的元素被点击时,接收浏览器发送的包括网页信息的网页请求,其中,网页信息包括元素在页面的原始网页中的位置、原始网页的统一资源定位符。
原始网页是指在个人计算机上显示的网页,现有网页的界面和风格是为个人计算机设计的,将这些原始网页直接在客户端的移动终端上显示,显示效果很难看,通过服务器将原始网页转码后,在移动终端上显示,可以获得较好的显示效果。但是,由于原始网页转码后html代码和结构发生较大变化,转码页面不支持原始网页一些需要用户点击才被触发的JavaScript,这造成网页功能的缺失。
为了保证需要用户点击以执行JavaScript的元素的网页功能正常使用,浏览器在第一次转码后的页面中该元素被点击时,向服务器发送包括网页信息的网页请求,其中,网页信息包括元素在页面的原始网页中的位置、页面的原始网页的统一资源定位符。
其中,该元素包括但不限于:具有onclick属性的元素、或具有href属性且以“javascript:”开头的元素。
其中,网页信息是服务器在对原始网页进行第一次转码的过程中,监测到需要用户点击以执行JavaScript的元素时生成的。即当服务器在对原始网页进行第一次转码的时候,如果监测到需要用户点击以执行JavaScript的元素,则生成网页信息,该网页信息包括元素在页面的原始网页中的位置、页面的原始网页的统一资源定位符。当服务器将第一次转码后的页面发送给浏览器时,也携带该 网页信息。
执行模块102用于根据统一资源定位符加载页面的原始网页,以及根据位置在原始网页中定位元素,并产生对元素的点击事件以执行JavaScript得到对应网页,将对应网页进行第二次转码。
服务器接收到浏览器的网页请求,网页请求中包括网页信息的,网页信息包括元素在页面的原始网页中的位置、页面的原始网页的统一资源定位符。
统一资源定位符是对可以从互联网上得到的资源的位置和访问方法的一种简洁的表示,是互联网上标准资源的地址,互联网上的每个文件都有一个唯一的URL,它包含的信息指出文件的位置以及浏览器应该怎么处理它。
根据统一资源定位符加载页面的原始网页,以及根据位置在原始网页中定位元素,并产生对元素的点击事件以执行JavaScript得到对应网页,将对应网页进行第二次转码。
其中,元素在原始网页中的位置以XPath语言标记。
XPath是一门在可扩展标记语言文档中查找信息的标记语言,用于在XML文档中通过元素和属性进行导航。当然,元素在原始网页中的位置还可以是用其它的标记语言进行标记的,例如:标准通用置标语言、超文本标记语言、可延伸超文件标记语言等等。
发送模块103用于将第二次转码后的页面发送给浏览器,以便浏览器显示第二次转码后的页面。
本发明实施方式服务器接收浏览器在第一次转码后的页面中需用户点击以执行JavaScript的元素被点击时,发送的包括网页信息的网页请求,网页信息包括元素在页面的原始网页中的位置、页面的原始网页的统一资源定位符;根据统一资源定位符加载页面的原始网页,以及根据位置在原始网页中定位元素,并产生对元素的点击事件以执行JavaScript得到对应网页,将对应网页进行第二次转码;将第二次转码后的页面发送给浏览器,以便浏览器显示第二次转码后的页面。通过这种方式,能够保证需要用户点击以执行JavaScript的元素的网页功能在客户端的正常使用。
参阅图7,图7是本发明网页转码装置一实施方式的结构示意图,该装置包括:发送模块201、接收模块202以及显示模块203。
发送模块201用于在第一次转码后的页面中,当需用户点击以执行JavaScript的元素被点击时,则向服务器发送包括网页信息的网页请求,其中,网页信息包括元素在页面的原始网页中的位置、原始网页的统一资源定位符。
原始网页是指在个人计算机上显示的网页,现有网页的界面和风格是为个人计算机设计的,将这些原始网页直接在客户端的移动终端上显示,显示效果不好,通过服务器将原始网页转码后,在移动终端上显示,可以获得较好的显示效果。但是,由于原始网页转码后html代码和结构发生较大变化,转码页面不支持原始网页一些需要用户点击才被触发的JavaScript,这造成网页功能的缺失。
为了保证需要用户点击以执行JavaScript的元素的网页功能正常使用,在第一次转码后的页面中该元素被点击时,浏览器向服务器发送包括网页信息的网页请求,其中,网页信息包括元素在页面的原始网页中的位置、页面的原始网页的统一资源定位符。
其中,该元素包括但不限于:具有onclick属性的元素、或具有href属性且以“javascript:”开头的元素。
其中,网页信息是服务器在对原始网页进行第一次转码的过程中,监测到需要用户点击以执行JavaScript的元素时生成的。即当服务器在对原始网页进行第一次转码的时候,如果监测到需要用户点击以执行JavaScript的元素,则生成网页信息,该网页信息包括元素在页面的原始网页中的位置、页面的原始网页的统一资源定位符。当服务器将第一次转码后的页面发送给浏览器时,也携带该网页信息。
接收模块202用于接收服务器响应网页请求而返回的第二次转码后的页面,其中,第二次转码后的页面是服务器根据统一资源定位符加载原始网页,以及根据位置在原始网页中定位元素,产生对元素的点击事件以执行JavaScript得到对应网页,以及将对应网页进行转码得到的。
统一资源定位符是对可以从互联网上得到的资源的位置和访问方法的一种 简洁的表示,是互联网上标准资源的地址,互联网上的每个文件都有一个唯一的URL,它包含的信息指出文件的位置以及浏览器应该怎么处理它。
当服务器接收到浏览器发送的网页请求后,由于网页请求中包括网页信息,网页信息包括元素在页面的原始网页中的位置、页面的原始网页的统一资源定位符,服务器根据统一资源定位符加载页面的原始网页,以及根据位置在原始网页中定位元素,并产生对元素的点击事件以执行JavaScript得到对应网页,将对应网页进行第二次转码。然后,服务器将第二次转码后的页面返回给浏览器,因此,浏览器接收服务器响应网页请求而返回的第二次转码后的页面。
其中,元素在原始网页中的位置以XPath语言标记。
XPath是一门在可扩展标记语言文档中查找信息的标记语言,用于在XML文档中通过元素和属性进行导航。当然,元素在原始网页中的位置还可以是用其它的标记语言进行标记的,例如:标准通用置标语言、超文本标记语言、可延伸超文件标记语言等等。
显示模块203用于显示第二次转码后的页面。
本发明实施方式当第一次转码后的页面中需用户点击以执行JavaScript的元素被点击,则浏览器向服务器发送包括网页信息的网页请求,其中,网页信息包括元素在页面的原始网页中的位置、页面的原始网页的统一资源定位符;接收服务器响应网页请求而返回的第二次转码后的页面,其中,第二次转码后的页面是服务器根据统一资源定位符加载页面的原始网页,以及根据位置在原始网页中定位元素,产生对元素的点击事件以执行JavaScript得到对应网页,以及将对应网页进行转码得到的;显示第二次转码后的页面。通过这种方式,能够保证需要用户点击以执行JavaScript的元素的网页功能在客户端的正常使用。
相应地,本发明还提供一种服务器,包括:处理器;用于存储处理器可执行指令的存储器;
存储器,用于存储计算机执行指令;
处理器,用于在第一次转码后的页面中,当需用户点击以执行JavaScript的元素被点击时,接收浏览器发送的包括网页信息的网页请求,其中,网页信息包括元素在页面的原始网页中的位置、原始网页的统一资源定位符;根据统一资源定位符加载原 始网页,以及根据位置在原始网页中定位元素,并产生对元素的点击事件以执行JavaScript得到对应网页,将对应网页进行第二次转码;将第二次转码后的页面发送给浏览器,以便浏览器显示第二次转码后的页面。
此外,本发明还提供一种终端,包括:处理器;用于存储处理器可执行指令的存储器;
存储器,用于存储计算机执行指令;
处理器,用于在第一次转码后的页面中,当需用户点击以执行JavaScript的元素被点击时,则向服务器发送包括网页信息的网页请求,其中,网页信息包括元素在页面的原始网页中的位置、原始网页的统一资源定位符;接收服务器响应网页请求而返回的第二次转码后的页面,其中,第二次转码后的页面是服务器根据统一资源定位符加载原始网页,以及根据位置在原始网页中定位元素,产生对元素的点击事件以执行JavaScript得到对应网页,以及将对应网页进行转码得到的;显示第二次转码后的页面。
相应地,本发明还提供一种非临时性计算机可读存储介质,包括计算机执行指令,以供计算机的处理器执行所述计算机执行指令时,所述计算机执行前述图1所示的网页转码方法。
相应地,本发明还提供一种非临时性计算机可读存储介质,包括计算机执行指令,以供计算机的处理器执行所述计算机执行指令时,所述计算机执行前述图2所示的网页转码方法。
以上所述仅为本发明的实施方式,并非因此限制本发明的专利范围,凡是利用本发明说明书及附图内容所作的等效结构或等效流程变换,或直接或间接运用在其他相关的技术领域,均同理包括在本发明的专利保护范围内。

Claims (14)

  1. 一种网页转码方法,其特征在于,所述方法包括:
    在第一次转码后的页面中,当需用户点击以执行JavaScript的元素被点击时,接收浏览器发送的包括网页信息的网页请求,其中,所述网页信息包括所述元素在所述页面的原始网页中的位置、所述原始网页的统一资源定位符;
    根据所述统一资源定位符加载所述原始网页,以及根据所述位置在所述原始网页中定位所述元素,并产生对所述元素的点击事件以执行JavaScript得到对应网页,将所述对应网页进行第二次转码;
    将第二次转码后的页面发送给所述浏览器,以便所述浏览器显示所述第二次转码后的页面。
  2. 根据权利要求1所述的方法,其特征在于,所述网页信息是服务器在对所述原始网页进行第一次转码的过程中,监测到需要用户点击以执行JavaScript的元素时生成的。
  3. 根据权利要求1所述的方法,其特征在于,所述元素在所述原始网页中的位置以XPath语言标记。
  4. 根据权利要求1所述的方法,其特征在于,所述元素包括具有onclick属性的元素、或具有href属性且以“javascript:”开头的元素。
  5. 一种网页转码方法,其特征在于,所述方法包括:
    在第一次转码后的页面中,当需用户点击以执行JavaScript的元素被点击时,则向服务器发送包括网页信息的网页请求,其中,所述网页信息包括所述元素在所述页面的原始网页中的位置、所述原始网页的统一资源定位符;
    接收所述服务器响应所述网页请求而返回的第二次转码后的页面,其中,所述第二次转码后的页面是所述服务器根据所述统一资源定位符加载所述原始网页,以及根据所述位置在所述原始网页中定位所述元素,产生对所述元素的点击事件以执行JavaScript得到对应网页,以及将所述对应网页进行转码得到的;
    显示所述第二次转码后的页面。
  6. 一种服务器,其特征在于,所述服务器包括:
    接收模块,用于在第一次转码后的页面中,当需用户点击以执行JavaScript 的元素被点击时,接收浏览器发送的包括网页信息的网页请求,其中,所述网页信息包括所述元素在所述页面的原始网页中的位置、所述原始网页的统一资源定位符;
    执行模块,用于根据所述统一资源定位符加载所述原始网页,以及根据所述位置在所述原始网页中定位所述元素,并产生对所述元素的点击事件以执行JavaScript得到对应网页,将所述对应网页进行第二次转码;
    发送模块,用于将第二次转码后的页面发送给所述浏览器,以便所述浏览器显示所述第二次转码后的页面。
  7. 根据权利要求6所述的服务器,其特征在于,所述网页信息是服务器在对所述原始网页进行第一次转码的过程中,监测到需要用户点击以执行JavaScript的元素时生成的。
  8. 根据权利要求6所述的服务器,其特征在于,所述元素在所述原始网页中的位置以XPath语言标记。
  9. 根据权利要求6所述的服务器,其特征在于,所述元素包括具有onclick属性的元素、或具有href属性且以“javascript:”开头的元素。
  10. 一种网页转码装置,其特征在于,所述装置包括:
    发送模块,用于在第一次转码后的页面中,当需用户点击以执行JavaScript的元素被点击时,则向服务器发送包括网页信息的网页请求,其中,所述网页信息包括所述元素在所述页面的原始网页中的位置、所述原始网页的统一资源定位符;
    接收模块,用于接收所述服务器响应所述网页请求而返回的第二次转码后的页面,其中,所述第二次转码后的页面是所述服务器根据所述统一资源定位符加载所述原始网页,以及根据所述位置在所述原始网页中定位所述元素,产生对所述元素的点击事件以执行JavaScript得到对应网页,以及将所述对应网页进行转码得到的;
    显示模块,用于显示所述第二次转码后的页面。
  11. 一种服务器,其特征在于,包括:处理器;用于存储处理器可执行指令的存储器;
    所述存储器,用于存储计算机执行指令;
    所述处理器,用于在第一次转码后的页面中,当需用户点击以执行JavaScript的元素被点击时,接收浏览器发送的包括网页信息的网页请求,其中,所述网页信息包括所述元素在所述页面的原始网页中的位置、所述原始网页的统一资源定位符;根据所述统一资源定位符加载所述原始网页,以及根据所述位置在所述原始网页中定位所述元素,并产生对所述元素的点击事件以执行JavaScript得到对应网页,将所述对应网页进行第二次转码;将第二次转码后的页面发送给所述浏览器,以便所述浏览器显示所述第二次转码后的页面。
  12. 一种终端,其特征在于,包括:处理器;用于存储处理器可执行指令的存储器;
    所述存储器,用于存储计算机执行指令;
    所述处理器,用于在第一次转码后的页面中,当需用户点击以执行JavaScript的元素被点击时,则向服务器发送包括网页信息的网页请求,其中,所述网页信息包括所述元素在所述页面的原始网页中的位置、所述原始网页的统一资源定位符;接收所述服务器响应所述网页请求而返回的第二次转码后的页面,其中,所述第二次转码后的页面是所述服务器根据所述统一资源定位符加载所述原始网页,以及根据所述位置在所述原始网页中定位所述元素,产生对所述元素的点击事件以执行JavaScript得到对应网页,以及将所述对应网页进行转码得到的;显示所述第二次转码后的页面。
  13. 一种非临时性计算机可读存储介质,其特征在于,包括计算机执行指令,以供计算机的处理器执行所述计算机执行指令时,所述计算机执行如权利要求1-4中任一项所述的网页转码方法。
  14. 一种非临时性计算机可读存储介质,其特征在于,包括计算机执行指令,以供计算机的处理器执行所述计算机执行指令时,所述计算机执行如权利要求5所述的网页转码方法。
PCT/CN2015/087795 2014-09-30 2015-08-21 网页转码方法、装置以及服务器 WO2016050124A1 (zh)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN201410522095.3 2014-09-30
CN201410522095.3A CN105528369B (zh) 2014-09-30 2014-09-30 网页转码方法、装置以及服务器

Publications (1)

Publication Number Publication Date
WO2016050124A1 true WO2016050124A1 (zh) 2016-04-07

Family

ID=55629415

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2015/087795 WO2016050124A1 (zh) 2014-09-30 2015-08-21 网页转码方法、装置以及服务器

Country Status (2)

Country Link
CN (1) CN105528369B (zh)
WO (1) WO2016050124A1 (zh)

Cited By (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN107844501A (zh) * 2016-09-20 2018-03-27 天脉聚源(北京)科技有限公司 一种移动终端处理网页弹窗的方法和系统
CN112364271A (zh) * 2020-12-15 2021-02-12 北京商越网络科技有限公司 一种网页间访问流转信息的获取方法
CN112583602A (zh) * 2020-12-08 2021-03-30 数字广东网络建设有限公司 信息码数据传输方法、装置、系统、计算机设备和介质
CN114327207A (zh) * 2021-11-22 2022-04-12 北京云测信息技术有限公司 元素定位方法、装置、电子设备及存储介质

Families Citing this family (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN108829398B (zh) * 2018-03-27 2022-06-17 厦门欣旅通科技有限公司 一种移动端页面交互实现方法及装置
CN109559174B (zh) * 2018-11-30 2021-04-16 上海连尚网络科技有限公司 推广资源打点以及统计推广资源点击的方法

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102902802A (zh) * 2012-10-12 2013-01-30 北京奇虎科技有限公司 一种网页转码方法和装置
CN103166981A (zh) * 2011-12-08 2013-06-19 腾讯科技(深圳)有限公司 一种无线网页转码方法及装置
CN103226475A (zh) * 2013-05-16 2013-07-31 百度在线网络技术(北京)有限公司 转码时实现控件替换的方法及装置
CN103577451A (zh) * 2012-07-30 2014-02-12 百度在线网络技术(北京)有限公司 网页转码方法、装置及系统

Family Cites Families (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103631795A (zh) * 2012-08-22 2014-03-12 百度在线网络技术(北京)有限公司 一种在网络设备中对网页进行转换的方法、装置和设备

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103166981A (zh) * 2011-12-08 2013-06-19 腾讯科技(深圳)有限公司 一种无线网页转码方法及装置
CN103577451A (zh) * 2012-07-30 2014-02-12 百度在线网络技术(北京)有限公司 网页转码方法、装置及系统
CN102902802A (zh) * 2012-10-12 2013-01-30 北京奇虎科技有限公司 一种网页转码方法和装置
CN103226475A (zh) * 2013-05-16 2013-07-31 百度在线网络技术(北京)有限公司 转码时实现控件替换的方法及装置

Cited By (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN107844501A (zh) * 2016-09-20 2018-03-27 天脉聚源(北京)科技有限公司 一种移动终端处理网页弹窗的方法和系统
CN112583602A (zh) * 2020-12-08 2021-03-30 数字广东网络建设有限公司 信息码数据传输方法、装置、系统、计算机设备和介质
CN112364271A (zh) * 2020-12-15 2021-02-12 北京商越网络科技有限公司 一种网页间访问流转信息的获取方法
CN114327207A (zh) * 2021-11-22 2022-04-12 北京云测信息技术有限公司 元素定位方法、装置、电子设备及存储介质

Also Published As

Publication number Publication date
CN105528369A (zh) 2016-04-27
CN105528369B (zh) 2019-03-15

Similar Documents

Publication Publication Date Title
WO2016050124A1 (zh) 网页转码方法、装置以及服务器
US10185704B2 (en) Webpage browsing method, webapp framework, method and device for executing javascript and mobile terminal
JP6748071B2 (ja) ウェブコンテンツ生成方法およびシステム
US9405745B2 (en) Language translation using embeddable component
JP5695027B2 (ja) Ajaxウェブページコンテンツを取得する方法およびシステム
US10572581B2 (en) System and method for web content presentation management
US10671698B2 (en) Language translation using embeddable component
US20140201617A1 (en) Method for Browsing Web Page on Mobile Terminal
CN102799372B (zh) 一种图片信息的上传方法及上传装置
WO2018001124A1 (zh) 网页文件发送方法、网页渲染方法及装置、网页渲染系统
US20100180192A1 (en) Dynamically configuring a presentation layer associated with a webpage delivered to a client device
WO2014206072A1 (zh) 预览网页的方法及系统
WO2015154666A1 (zh) 桌面展示网页片段的方法及截取网页片段至桌面展示系统
CN108415804B (zh) 获取信息的方法、终端设备及计算机可读存储介质
US20110145299A1 (en) Offline Gadgets IDE
TWI539302B (zh) 用於網路服務的延後資源當地語系化連結
WO2019080796A1 (zh) web系统的前后端分离方法、装置、设备及存储介质
JP2017504129A (ja) ウェブブラウザにおいて表わされる状態表現の構築
US20130191726A1 (en) Automatic widget creation apparatus and method for invoking heterogeneous web services in a composite application
US9465814B2 (en) Annotating search results with images
KR20120016333A (ko) 웹 어플리케이션을 위한 사전 캐싱 방법 및 이를 적용한 단말 장치
US20150161177A1 (en) Search result image processing
US10846361B2 (en) User-specific customization of web pages
US10095791B2 (en) Information search method and apparatus
US9727397B2 (en) Container-less JSP template

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: 15847575

Country of ref document: EP

Kind code of ref document: A1

NENP Non-entry into the national phase

Ref country code: DE

122 Ep: pct application non-entry in european phase

Ref document number: 15847575

Country of ref document: EP

Kind code of ref document: A1