CN104978277B - For debugging the method, terminal and server of the page - Google Patents

For debugging the method, terminal and server of the page Download PDF

Info

Publication number
CN104978277B
CN104978277B CN201510459724.7A CN201510459724A CN104978277B CN 104978277 B CN104978277 B CN 104978277B CN 201510459724 A CN201510459724 A CN 201510459724A CN 104978277 B CN104978277 B CN 104978277B
Authority
CN
China
Prior art keywords
debugged
page
source code
server
terminal
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.)
Active
Application number
CN201510459724.7A
Other languages
Chinese (zh)
Other versions
CN104978277A (en
Inventor
赵成阳
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Beijing Baidu Netcom Science and Technology Co Ltd
Original Assignee
Beijing Baidu Netcom Science and Technology 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 Baidu Netcom Science and Technology Co Ltd filed Critical Beijing Baidu Netcom Science and Technology Co Ltd
Priority to CN201510459724.7A priority Critical patent/CN104978277B/en
Publication of CN104978277A publication Critical patent/CN104978277A/en
Application granted granted Critical
Publication of CN104978277B publication Critical patent/CN104978277B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Landscapes

  • Debugging And Monitoring (AREA)

Abstract

This application discloses the methods, terminal and server for debugging the page.One specific embodiment of the method includes: the source code for obtaining the page to be debugged;Adjust the path of resource to be referred to file in source code;Source code behind adjustment resource file path is encoded, page data to be debugged is obtained;And page data to be debugged is sent to server.The embodiment realizes while debugging the page in multiple terminals, improves the efficiency of page debugging.

Description

Method, terminal and server for debugging page
Technical Field
The application relates to the technical field of electric digital data processing, in particular to the technical field of error detection and monitoring, and particularly relates to a method, a terminal and a server for debugging a page.
Background
In the prior art, the following two methods are generally adopted to debug pages at multiple terminals: one is that the URL of the page is input into each terminal in turn manually, and the debugging result is checked; the other method is that each terminal is connected with a control end through a data line, a developer mode of a plurality of terminals is started simultaneously, and a terminal page is debugged on the control end through a control program.
In the method, when the page URL changes, the manual operation method needs to re-open the browser of the terminal and input the page URL for debugging, and the debugging method has complicated steps and low efficiency; in the method for physically connecting the terminal and the control terminal, the control program cannot be reused for different terminals, different control programs need to be provided for different terminals, and debugging efficiency is not high.
Disclosure of Invention
In view of the above-mentioned shortcomings or drawbacks of the prior art, it is desirable to provide an efficient method for debugging pages in multiple terminals. In order to solve one or more of the problems, the application provides a method, a terminal and a server for debugging a page.
In a first aspect, the present application provides a method for debugging a page, including: acquiring a source code of a page to be debugged; adjusting the path of the resource file referenced in the source code; encoding the source code after the resource file path is adjusted to obtain page data to be debugged; sending page data to be debugged to a server; and the page data to be debugged is distributed to the multiple terminals to be debugged through the server, so that the multiple terminals to be debugged decode the received page data to be debugged and generate corresponding pages.
In some optional implementations, adjusting the path of the resource file referenced in the source code includes: extracting contents of different types of language structures in source codes of a page to be debugged; adjusting relative paths of resource files referenced in the contents of different types of language structures to absolute paths; the encoding of the source code after the resource file path is adjusted comprises the following steps: and respectively coding different types of language structures after the resource file path is adjusted.
In some optional implementations, the method for debugging a page further includes: a connection request is sent to the server to establish two-way communication with the server.
In some optional implementations, the method for debugging a page further includes: and responding to the operation of changing the source code of the page to be debugged, and changing the source code of the page to be debugged.
In a second aspect, the present application provides a method for debugging a page, comprising: receiving page data to be debugged from a server; decoding page data to be debugged; and generating a corresponding page based on the decoded page data to be debugged. The page data to be debugged is generated by the control terminal according to the following mode and then is sent to the server: adjusting the path of a resource file quoted by the acquired source code of the page to be debugged; and encoding the source code after the path of the resource file is adjusted.
In some optional implementation manners, the adjusting the path of the resource file that refers to the obtained source code of the page to be debugged includes: extracting contents of different types of language structures in source codes of a page to be debugged; the relative path of the resource files referenced in the content of the different types of language structures is adjusted to an absolute path. Encoding the source code after adjusting the resource file path, comprising: and respectively coding different types of language structures after the resource file path is adjusted.
In a further implementation, decoding the page data to be debugged includes: and decoding the different types of coded language structures. Generating a corresponding page based on the decoded page data to be debugged, including: splicing the decoded different types of language structures into corresponding page source codes; and generating a corresponding page according to the corresponding page source code.
In some optional implementations, the method for debugging a page further includes: a connection request is sent to the server to establish two-way communication with the server.
In a third aspect, the present application provides a method for debugging a page, including: receiving page data to be debugged sent by a control terminal; and sending the page data to be debugged to the terminal to be debugged so as to enable the terminal to be debugged to decode the page data to be debugged and generate a corresponding page. The page data to be debugged is generated by the control terminal according to the following mode: and adjusting and coding the resource file path of the acquired source code of the page to be debugged.
In some optional implementations, the method for debugging a page further includes: receiving a connection request of a control terminal and a terminal to be debugged; and establishing two-way communication with the control terminal and the terminal to be debugged respectively.
In a fourth aspect, the present application provides a terminal, including: the acquiring unit is used for acquiring a source code of a page to be debugged; the adjusting unit is used for adjusting the path of the middle resource file referenced by the source code; the encoding unit is used for encoding the source code after the resource file path is adjusted to obtain page data to be debugged; and the sending unit is used for sending the page data to be debugged to the server. The page data to be debugged is distributed to the multiple terminals to be debugged through the server, so that the multiple terminals to be debugged decode the received page data to be debugged and generate corresponding pages.
In some optional implementations, the adjusting unit is configured to adjust the path of the resource file referenced in the source code as follows: extracting contents of different types of language structures in source codes of a page to be debugged; the relative path of the resource files referenced in the content of the different types of language structures is adjusted to an absolute path. The encoding unit is used for encoding the source code after the resource file path is adjusted according to the following modes: and respectively coding different types of language structures after the resource file path is adjusted.
In some optional implementations, the terminal further includes: a connection unit for sending a connection request to the server to establish bidirectional communication with the server.
In some optional implementations, the terminal further includes: and the changing unit is used for responding to the operation of changing the source code of the page to be debugged and changing the source code of the page to be debugged.
In a fifth aspect, the present application provides a terminal, comprising: the receiving unit is used for receiving page data to be debugged from the server; the decoding unit is used for decoding page data to be debugged; and the generating unit is used for generating a corresponding page based on the decoded page data to be debugged. The page data to be debugged is generated by the control terminal according to the following mode and then is sent to the server: adjusting the path of a resource file quoted by the acquired source code of the page to be debugged; and encoding the source code after the path of the resource file is adjusted.
In some optional implementation manners, the adjusting the path of the resource file that refers to the obtained source code of the page to be debugged includes: extracting contents of different types of language structures in a page to be debugged; the relative path of the resource files referenced in the content of the different types of language structures is adjusted to an absolute path. Encoding the source code after adjusting the resource file path, comprising: and respectively coding different types of language structures after the resource file path is adjusted.
In a further implementation, the decoding unit is configured to decode the page data to be debugged as follows: and decoding the different types of coded language structures. The generating unit is used for generating the corresponding page as follows: splicing the decoded different types of language structures into corresponding page source codes; and generating the corresponding page according to the corresponding page source code.
In some optional implementations, the terminal further includes: a connection unit for sending a connection request to the server to establish bidirectional communication with the server.
In a sixth aspect, the present application provides a server, comprising: the first receiving unit is used for receiving page data to be debugged sent by the control terminal; and the sending unit is used for sending the page data to be debugged to the terminal to be debugged so as to enable the terminal to be debugged to decode the page data to be debugged and generate a corresponding page. The page data to be debugged is generated by the control terminal according to the following mode: and adjusting and coding the resource file path of the acquired source code of the page to be debugged.
In some optional implementations, the server further includes: the second receiving unit is used for receiving the connection request of the control terminal and the terminal to be debugged; and the connecting unit is used for establishing two-way communication with the control terminal and the terminal to be debugged respectively.
According to the method, the terminal and the server for debugging the page, the source code of the debugged page is obtained, the path of the file in the source code is adjusted and is sent to the server after being coded, and the server distributes the coded data to the plurality of terminals. Therefore, the page can be debugged at a plurality of terminals at the same time without physically connecting the terminal to be debugged with the control equipment, the operation of debugging the page is simplified, and the efficiency of debugging the page is improved.
Drawings
Other features, objects and advantages of the present application will become more apparent upon reading of the following detailed description of non-limiting embodiments thereof, with reference to the accompanying drawings in which:
FIG. 1 is an exemplary system architecture diagram to which embodiments of the present application may be applied;
FIG. 2 is a flow diagram of one embodiment of a method for debugging a page provided by an embodiment of the present application;
FIG. 3 is a flow diagram of another embodiment of a method for debugging a page provided by an embodiment of the present application;
FIG. 4 is a flow diagram of yet another embodiment of a method for debugging a page provided by an embodiment of the present application;
fig. 5 is a schematic structural diagram of an embodiment of a terminal provided in the present application;
fig. 6 is a schematic structural diagram of another embodiment of a terminal provided in the embodiment of the present application;
FIG. 7 is a block diagram illustrating an embodiment of a server provided by an embodiment of the present application;
fig. 8 is a schematic structural diagram of a computer system suitable for implementing a terminal or a server according to an embodiment of the present application.
Detailed Description
The present application will be described in further detail with reference to the following drawings and examples. It is to be understood that the specific embodiments described herein are merely illustrative of the relevant invention and not restrictive of the invention. It should be noted that, for convenience of description, only the portions related to the related invention are shown in the drawings.
It should be noted that the embodiments and features of the embodiments in the present application may be combined with each other without conflict. The present application will be described in detail below with reference to the embodiments with reference to the attached drawings.
FIG. 1 illustrates an exemplary system architecture 100 to which embodiments of the present application may be applied.
As shown in fig. 1, the system architecture 100 may include terminals 101, 102, 103, 104, a network 105, and a server 106. The network 105 is the medium used to provide communication links between the terminal 101 and the server 106 and the terminals 102, 103, 104 and the server 106. Network 105 may include various connection types, such as wired, wireless communication links, or fiber optic cables, to name a few.
User 110 may use terminal 101 to send a message to server 106 through network 105. The server 106 may send messages to the terminals 102, 103, 104 via the network 105. Browsers may be installed in the terminals 102, 103, and 104, and a control program may be installed on the terminal 101 to control the browsers in the terminals 102, 103, and 104.
The terminals 101, 102, 103, 104 may be various electronic devices including, but not limited to, personal computers, smart phones, smart watches, tablets, personal digital assistants, and the like.
The server 105 may be a server that provides various services. The server may perform processing such as storage, analysis, and the like on data received from the terminal 101, and feed back the processing result to the terminals 102, 103, and 104.
It should be understood that the number of terminals, networks, and servers in fig. 1 are merely illustrative. There may be any number of terminal devices, networks, and servers, as desired for implementation.
Referring to fig. 2, shown is a flowchart of an embodiment of a method for debugging a page provided by an embodiment of the present application.
As shown in fig. 2, in step 201, a source code of a page to be debugged is obtained.
In this embodiment, the control terminal may open the page to be debugged through the browser, and obtain the source code of the page to be debugged. Specifically, the control terminal may initiate a request for obtaining the source code of the page to the server, and the server may send the source code to the control terminal in response to the request. Further, the request initiated by the control terminal may include a URL (Uniform Resource Locator) of the page to be debugged, and the server searches for the source code based on the URL and sends the source code to the control terminal. In some implementations, the server may obtain the source code of the page to be debugged through a scripting language of java or php.
In the page debugging process, if the source code of the page is changed, the control terminal can automatically acquire the source code of the changed page again through the method.
The source code of the page may include source code in HTML (HyperText Markup Language) format. HTML can be used to mark elements and attributes of elements in a web page. The source code of the page may also include source codes in CSS (Cascading Style Sheet) and JavaScript (JavaScript) formats. CSS may be used to mark up the style of a web page and JavaScript may be used to add interactive behavior to an HTML page.
In step 202, the path of the resource file referenced in the source code is adjusted.
In this embodiment, the control terminal may parse the source code obtained in step 201, and extract a path of the resource file referred to therein. The path of the resource file in the HTML source code may include a relative path and an absolute path. Where an absolute path may be a URL with a full domain name prefix, such as "http:// www.***.com/image/logo. png," a relative path may be a path that begins with "/" or "//", such as "/image/logo. png. The control terminal can replace the relative paths into absolute paths and then send the absolute paths to the terminal to be debugged so as to ensure that the page displayed in the terminal to be debugged can normally load the resource files.
In some alternative implementations, the path of the resource file referenced in the source code may be adjusted by: and extracting the contents of different types of language structures in the source code of the page to be debugged, and then adjusting the relative path of the resource file quoted in the contents of the different types of language structures into an absolute path. Specifically, the source code of the page may be firstly decomposed into an HTML structure, an inline CSS structure, an inline JavaScript, an external chain CSS, an external chain JavaScript, and other structures, the relative paths of the resource files referenced in the HTML structure, the inline CSS structure, and the inline JavaScript are respectively modified into absolute paths, and the paths of the external chain CSS and the external chain JavaScript are respectively adjusted into absolute paths, so as to ensure that when the control terminal sends the page to the terminal to be debugged through the network, the terminal to be debugged can normally load the files according to the absolute paths.
In the page debugging process, if the developer changes the source code of the page and the control terminal obtains the changed source code, the path of the resource file referred in the changed source code may be extracted in step 202, and corresponding adjustment is performed.
In step 203, the source code after the resource file path is adjusted is encoded to obtain page data to be debugged.
In this embodiment, after adjusting the path of the resource file referred to in the source code, the control terminal may encode the source code to debug the page to be debugged through the network. An alternative to encoding is Base64 encoding. Base64 is one of the encoding methods for transmitting 8-bit byte codes, and can be used for transmitting longer identification information in the HTTP environment. In some applications, it is also often necessary to encode the binary data into a form suitable for placement in a URL. The Base64 code is not only short, but also has no readability. Other common encoding methods, such as ASCII encoding and Unicode encoding, may also be used. In a specific implementation, the page source code after the resource file path is adjusted can be converted according to the encoding table of Base64, and the HTML structure, style and script in the page source code are converted into characters for network debugging.
And after the control terminal encodes the source code, the page data to be debugged can be obtained. In some implementations, if the control terminal decomposes the source code of the page into different types of language structures (including an HTML structure, an inline CSS, an inline JavaScript, an outbound CSS, and an outbound JavaScript) in step 202 and adjusts the resource file paths of the structures respectively, the different types of language structures after the resource file paths are adjusted may be encoded respectively. The HTML structure, the in-line CSS, the in-line JavaScript, the out-link CSS and the out-link JavaScript can be coded respectively, so that the coding result of each structure is obtained, and the scattered page data to be debugged is obtained.
In step 204, the page data to be debugged is sent to the server.
The control terminal can send a message to the server through the network port, and the server can authenticate the control terminal when detecting that the message is transmitted, and receive the message after the authentication is passed. At this time, the control terminal may send the page data to be debugged to the server through the network. The server may receive the page data to be debugged through a network device (e.g., a network card, etc.).
In some embodiments, the control terminal may send a connection request to the server to establish bidirectional communication with the server before sending the page data to be debugged to the server. Optionally, a webserver may be started (i.e., a server is started) through a socket.io server-side script, and the control terminal may establish communication by sending a connection request to the server. IO is an open-source code library, and can realize a real-time bidirectional event-based communication mechanism, wherein a Websocket protocol is packaged. Websocket is a protocol introduced by HTML5 specification, can realize real-time data transmission, and solves the problem of low data debugging efficiency caused by excessive occupation of HTTP request bandwidth in the existing data transmission mode.
Optionally, when the control terminal opens the page to be debugged, a Websocket request may be sent to the server, so as to ensure that long connection between the server and the control terminal may be maintained. After establishing a long connection with the server, the control terminal may send the data to be debugged to the server. And the page data to be debugged is distributed to the multiple terminals to be debugged through the server, so that the multiple terminals to be debugged decode the received page data to be debugged and generate corresponding pages.
In this embodiment, each terminal to be debugged may also send a Websocket request to the server to establish a long connection with the server. The server can simultaneously forward the received page data to be debugged to a plurality of terminals to be debugged. Therefore, the plurality of terminals to be debugged can construct the webpage according to the received webpage data to be debugged. The page data to be debugged may include the encoded page source code, and the terminal to be debugged may decode the page data to be debugged in a decoding manner corresponding to the encoding manner, and then render the web page based on the decoded code. Optionally, when the page data to be debugged includes page data of different language structures, after decoding, the codes of different language structures may be spliced according to the format of the page source code, so as to generate a complete page.
In some embodiments, the method for debugging a page may further include: and responding to the operation of changing the source code of the page to be debugged, and changing the source code of the page to be debugged.
If the user changes the source code of the page to be debugged in the process of debugging the page, the control terminal can execute the change of the source code according to the operation of the user. At this time, the control terminal may synchronize the updated page data to the terminal to be debugged. Specifically, the step 201 and the step 204 may be executed to obtain the source code of the modified page to be debugged, and send the modified source code to the server after performing path adjustment and encoding on the resource file referenced by the source code, so as to modify the source code of the page of the terminal to be debugged. Optionally, the control terminal may send a command for refreshing the page to the server, and after the server forwards the command to the terminal to be debugged, the terminal to be debugged may refresh the page according to the command.
In the method for debugging a page provided in the above embodiment, the source code of the page to be debugged is acquired on the control terminal, then the path of the resource file referred in the source code is adjusted, then the source code after the path of the resource file is adjusted is encoded, for example, Base64, and the encoded data is sent to the server, so that the server distributes the data to a plurality of terminals to be debugged, thereby realizing that the web pages of a plurality of terminals to be debugged are debugged simultaneously by the control terminal, ensuring the real-time performance of debugging without physically connecting the plurality of terminals to be debugged with the control terminal, and improving the debugging efficiency.
With further reference to fig. 3, shown is a flow diagram of another embodiment of a method for debugging a page provided by an embodiment of the present application.
As shown in fig. 3, in step 301, page data to be debugged is received from a server.
The page data to be debugged is generated by the control terminal according to the following mode and then is sent to the server: adjusting the path of a resource file quoted by the acquired source code of the page to be debugged; and encoding the source code after the path of the resource file is adjusted.
In this embodiment, the terminal to be debugged may receive the page data to be debugged generated by the control terminal code. The page data to be debugged may include the page source code after the resource file path adjustment and encoding. Optionally, the page data to be debugged may further include configuration data transmitted by a network, for example, encapsulation data of a network protocol.
In some embodiments, before receiving the page data to be debugged from the server, the terminal to be debugged may also send a connection request to the server to establish bidirectional communication with the server. For example, the terminal to be debugged may send a Websocket request to the server. Therefore, when the terminal to be debugged and the server carry out data debugging, HTTP requests do not need to be sent again, the bandwidth occupancy rate is reduced, and the data transmission speed is increased.
In step 302, the page data to be debugged is decoded.
The page data to be debugged may include encoded page source code. In this embodiment, the terminal to be debugged may decode the page data to be debugged to obtain the source code of the page. In some implementations, the terminal to be debugged may also parse the page data to be debugged, analyze the parsed page data to obtain a coding mode, and decode the decoded page data in a corresponding decoding mode. For example, when the control end encodes the source code in a Base64 encoding manner, the terminal to be debugged may decode the page data to be debugged by using Base64 decoding.
In some implementations, in the process of the page data to be debugged, the control terminal adjusts the path of the resource file that is referred to by the source code of the page to be debugged. Alternatively, the path adjustment of the referenced resource file may be implemented as follows: and extracting contents of different types of language structures in the source code of the page to be debugged, and adjusting the relative path of the resource file quoted in the contents of the different types of language structures into an absolute path. When the page data to be debugged is coded, different types of language structures after the resource file path is adjusted can be respectively coded. Correspondingly, when the page data to be debugged is decoded, the different types of language structures after being coded can be decoded respectively. For example, if the page data to be debugged sent by the control end includes the encoded HTML structure, the CSS structure, and the different types of language structures in the JavaScript script, the three structures may be decoded respectively to obtain the source codes corresponding to the three structures.
In step 303, a corresponding page is generated based on the decoded page data to be debugged.
After decoding, the source code obtained by decoding may be injected into the current page opened by the terminal to be debugged, so as to display the debugged page. In some implementations, if the control terminal decomposes the contents of different types of language structures and respectively adjusts the resource file paths when adjusting the resource file paths, the terminal to be debugged obtains the contents of different types of language structures after decoding. The terminal to be debugged may splice the decoded structures into corresponding page source codes, and generate a corresponding page according to the corresponding page source codes, for example, may inject the decoded HTML structure, CSS structure, and Javascript structure into the current page to generate and display a complete page. Specifically, the browser of the terminal to be debugged may parse syntax of the decoded data (such as HTML, CSS, JavaScript, and the like), add a corresponding internal data structure (such as a DOM tree of HTML, an attribute table of JavaScript, a style rule of CSS, and the like), construct a rendering tree, perform position calculation and style calculation on each element, and then render the page according to the rendering tree. In some implementations, the browser of the terminal to be debugged can automatically render the DOM tree, execute the script, and display the same page effect as the page to be debugged in debugging on the page of the browser.
Optionally, in the above method, the terminal to be debugged may create a new page when the user starts debugging, and the page may maintain a long connection with the server through Websocket. After decoding the page data to be debugged, the resulting page may be displayed on the created new page. And if the user changes the source code of the page to be debugged on the control terminal in the debugging process, the control terminal acquires the source code of the page again, adjusts and codes the path of the quoted resource file and then sends the recoded page data to the server. At this time, the control terminal may also send an instruction to refresh the page to the server. And the server distributes the instruction and the page data to the terminal to be debugged. The terminal to be debugged can decode again according to the received instruction to obtain the changed page.
For the above embodiment of the present application, the application scenario may be that a user loads a socket.io code library on a computer, starts a webserver service, and opens a debugged page through a main control program. The main control program can send a Websocket request to the webserver so as to keep long connection between the webserver and the user computer. A user can open a webpage on a plurality of mobile terminals (e.g., mobile phones, tablet computers, etc.) through a browser, a control program can be installed on the mobile terminal, and the user can load a socket. The control program can establish a long connection with the server by sending a Websocket request to the webserver. The webpage opened by the mobile terminal browser can be kept in long connection with the server by means of a socket. It should be noted that the main control program run by the user on the computer for debugging the page is different from the control program on the mobile terminal. The main control program can obtain the source code of the page, adjust the path of the resource file quoted in the page, then encode the page and transmit the page to the server. The server can simultaneously forward the data received from the main control computer to a plurality of mobile terminals. In the debugging process, the main control program can monitor whether the page source code is changed in real time, if the page source code is monitored to be changed, the path of the resource file quoted in the source code can be readjusted, and the resource file is recoded and then sent to the server. After receiving the data sent by the server, the mobile terminals can decode the data through the control program and render the webpage based on the webpage source code obtained through decoding.
Referring to fig. 4, a flowchart of yet another embodiment of a method for debugging a page provided by an embodiment of the present application is shown.
As shown in fig. 4, in step 401, page data to be debugged sent by the control terminal is received.
The server can establish communication connection with the control terminal and the terminal to be debugged through a network. In this embodiment, a user may start a webserver (i.e., a server) by using a server-side script provided by socket. The page data to be debugged can be generated by the control terminal according to the following modes: and adjusting and coding the resource file path of the acquired source code of the page to be debugged. Alternatively, the server may receive a connection request from the control terminal to establish bidirectional communication with the control terminal. For example, the server may receive a Websocket request sent by the control terminal, establish a long connection with the control terminal, and receive data sent by the control terminal through the long connection.
In step 402, the page data to be debugged is sent to the terminal to be debugged.
In this embodiment, after receiving the data to be debugged sent by the control terminal, the server may immediately forward the data to the terminal to be debugged, so that the terminal to be debugged decodes the page data to be debugged and generates a corresponding page. The terminal to be debugged can receive page data to be debugged. Alternatively, a page may be opened in the browser, which may establish a long connection with the server by sending a Websocket request. It should be noted that the number of the terminals to be debugged may be multiple, so that the page to be debugged can be debugged on multiple terminals to be debugged at the same time. The terminal to be debugged may be installed with a control program for decoding the received data and rendering a web page.
In some implementations, if the user changes the source code of the page to be debugged, the control end may send an instruction to refresh the page to the server. The server can also forward the instruction to the terminal to be debugged. And after the terminal to be debugged receives the refreshing instruction, refreshing the page based on the currently received coded page source code.
According to the method for debugging the page, the page to be debugged is decoded and the corresponding page is generated by the terminal to be debugged by receiving the page data to be debugged after the control terminal adjusts the path of the resource file and encodes the path of the resource file and sending the page data to be debugged to the terminal to be debugged, so that the page can be debugged at a plurality of terminals at the same time, the operation of debugging the page is simplified, and the efficiency of page debugging is improved.
Referring to fig. 5, a schematic diagram of a structure 500 of an embodiment of a terminal provided in the present application is shown. As shown in fig. 5, the terminal 500 may include an acquisition unit 501, an adjustment unit 502, an encoding unit 503, and a transmission unit 504. The obtaining unit 501 may be configured to obtain a source code of a page to be debugged, the adjusting unit 502 may be configured to adjust a path of a resource file referred in the source code, the encoding unit 503 may be configured to encode the source code after the path of the resource file is adjusted, so as to obtain page data to be debugged, and the sending unit 504 may be configured to send the page data to be debugged to a server. The page data to be debugged can be distributed to a plurality of terminals to be debugged through the server, so that the plurality of terminals to be debugged can decode the received page data to be debugged and generate corresponding pages.
In some implementations, the adjustment unit 502 may be configured to adjust the path of the resource file referenced in the source code as follows: extracting contents of different types of language structures in source codes of a page to be debugged; the relative path of the resource files referenced in the content of the different types of language structures is adjusted to an absolute path. The encoding unit 503 may be configured to encode the source code after adjusting the resource file path as follows: and respectively coding different types of language structures after the resource file path is adjusted.
In some embodiments, the terminal 500 may further include a connection unit 505 and a modification unit 506 (not shown). The connection unit 505 may be configured to send a connection request to the server to establish a bi-directional communication with the server. For example, the connection unit may send a Websocket request to the server, establishing bidirectional communication of the terminal 500 with the server. The changing unit 506 may be configured to, in the process of debugging the page by the user, change the source code of the page to be debugged in response to an operation of changing the source code of the page to be debugged. The terminal 500 after the source code is changed can perform corresponding operations on the changed source code through the obtaining unit 501, the adjusting unit 502, the encoding unit 503 and the sending unit 504, so as to transmit the changed page information to the terminal to be debugged.
The terminal 500 provided by the above embodiment can debug the web pages of a plurality of terminals to be debugged through the control terminal, and the multiple terminals to be debugged are not required to be physically connected with the control terminal, so that the debugging real-time performance can be ensured, and the debugging efficiency is improved.
Referring to fig. 6, a schematic diagram of a structure 600 of another embodiment of the terminal provided in the embodiment of the present application is shown.
As shown in fig. 6, the terminal 600 may include a receiving unit 601, a decoding unit 602, and a generating unit 603. The receiving unit 601 may be configured to receive page data to be debugged from a server. The decoding unit 602 may be configured to decode page data to be debugged. The generating unit 603 may be configured to generate a corresponding page based on the decoded page data to be debugged. The page data to be debugged can be generated by the control terminal according to the following mode and then sent to the server: adjusting the path of the resource file of the source code of the acquired page to be debugged; and encoding the source code after the path of the resource file is adjusted.
In this embodiment, the server and the terminal 600 may perform information interaction through a network. After receiving the page data to be debugged processed by the control terminal, the server may send the page data to be debugged to the terminal 600. The receiving unit 600 may receive page data to be debugged and pass the data to the decoding unit 602 for decoding. The decoding unit 602 may perform decoding in a decoding manner corresponding to the encoding manner of the control end to obtain the source code of the page to be debugged. The generating unit 603 may generate a corresponding page from the decoded page source code by rendering a webpage with a browser.
In some implementations, if the control terminal adjusts the path of the resource file referenced in the page source code by extracting the contents of different types of language structures in the page source code and adjusting the relative path of the resource file referenced in the contents of different types of language structures to an absolute path, and encodes the different types of language structures after the path of the resource file is adjusted, respectively, the decoding unit 602 of the terminal 600 may be configured to decode the encoded different types of language structures. At this time, the generating unit 603 may be configured to splice the decoded different types of language structures into corresponding page source codes, and generate corresponding pages according to the corresponding page source codes.
In some embodiments, the terminal 600 may further comprise a connection unit for sending a connection request to the server to establish a bi-directional communication with the server.
The terminal 600 provided by the above embodiment can receive and display the page data of the page to be debugged in real time through the communication connection with the server, thereby improving the efficiency of page debugging.
Referring to fig. 7, a schematic diagram of a structure 700 of an embodiment of a server provided by an embodiment of the present application is shown.
As shown in fig. 7, the server 700 may include a first receiving unit 701 and a transmitting unit 702. The first receiving unit 701 may be configured to receive page data to be debugged sent by the control terminal, and the sending unit 702 may be configured to send the page data to be debugged to the terminal to be debugged, so that the terminal to be debugged decodes the page data to be debugged and generates a corresponding page. The page data to be debugged can be generated by the control terminal according to the following modes: and adjusting and coding the resource file path of the acquired source code of the page to be debugged.
In some embodiments, the server 700 may further include a second receiving unit and a connecting unit. The second receiving unit may be configured to receive a connection request of the control terminal and the terminal to be debugged, and the connection unit may be configured to establish bidirectional communication with the control terminal and the terminal to be debugged, respectively.
The server 700 provided by the above embodiment of the present application serves as an intermediary between the control terminal and the terminal to be debugged, and transmits the page data of the page to be debugged, thereby implementing the simultaneous debugging of multiple pages of the terminal to be debugged on the control terminal, simplifying the operation of page debugging, and improving the debugging efficiency.
It should be understood that the units recited in the terminals 500, 600 and the server 700 correspond to the respective steps in the methods described with reference to fig. 2, 3 and 4, respectively. Thus, the operations and features described above for the method for debugging a page are equally applicable to the terminals 500, 600 and the server 700 and the units included therein, and will not be described again here.
Referring now to FIG. 8, shown is a block diagram of a computer system 800 suitable for use in implementing a terminal or server of an embodiment of the present application.
As shown in fig. 8, the computer system 800 includes a Central Processing Unit (CPU)801 that can perform various appropriate actions and processes in accordance with a program stored in a Read Only Memory (ROM)802 or a program loaded from a storage section 808 into a Random Access Memory (RAM) 803. In the RAM 803, various programs and data necessary for the operation of the system 800 are also stored. The CPU 801, ROM 802, and RAM 803 are connected to each other via a bus 804. An input/output (I/O) interface 805 is also connected to bus 804.
The following components are connected to the I/O interface 805: an input portion 806 including a keyboard, a mouse, and the like; an output section 807 including a signal such as a Cathode Ray Tube (CRT), a Liquid Crystal Display (LCD), and the like, and a speaker; a storage portion 808 including a hard disk and the like; and a communication section 809 including a network interface card such as a LAN card, a modem, or the like. The communication section 809 performs communication processing via a network such as the internet. A drive 810 is also connected to the I/O interface 805 as necessary. A removable medium 811 such as a magnetic disk, an optical disk, a magneto-optical disk, a semiconductor memory, or the like is mounted on the drive 810 as necessary, so that a computer program read out therefrom is mounted on the storage section 808 as necessary.
In particular, according to an embodiment of the present disclosure, the processes described above with reference to the flowcharts may be implemented as computer software programs. For example, embodiments of the present disclosure include a computer program product comprising a computer program tangibly embodied on a machine-readable medium, the computer program comprising program code for performing the method illustrated in the flow chart. In such an embodiment, the computer program can be downloaded and installed from a network through the communication section 809 and/or installed from the removable medium 811.
The flowchart and block diagrams in the figures illustrate the architecture, functionality, and operation of possible implementations of systems, methods and computer program products according to various embodiments of the present invention. In this regard, each block in the flowchart or block diagrams may represent a module, segment, or portion of code, which comprises one or more executable instructions for implementing the specified logical function(s). It should also be noted that, in some alternative implementations, the functions noted in the block may occur out of the order noted in the figures. For example, two blocks shown in succession may, in fact, be executed substantially concurrently, or the blocks may sometimes be executed in the reverse order, depending upon the functionality involved. It will also be noted that each block of the block diagrams and/or flowchart illustration, and combinations of blocks in the block diagrams and/or flowchart illustration, can be implemented by special purpose hardware-based systems which perform the specified functions or acts, or combinations of special purpose hardware and computer instructions.
The units described in the embodiments of the present application may be implemented by software or hardware. The described units may also be provided in a processor, and may be described as: a processor includes an acquisition unit, a feature extraction unit, and a training unit. Where the names of these units do not in some cases constitute a limitation of the unit itself, for example, an acquisition unit may also be described as a "unit for acquisition".
As another aspect, the present application also provides a computer-readable storage medium, which may be the computer-readable storage medium included in the apparatus in the above-described embodiments; or it may be a separate computer-readable storage medium not incorporated in the terminal. The computer readable storage medium stores one or more programs for use by one or more processors in performing the methods for debugging pages described herein.
The above description is only a preferred embodiment of the application and is illustrative of the principles of the technology employed. It will be appreciated by a person skilled in the art that the scope of the invention as referred to in the present application is not limited to the embodiments with a specific combination of the above-mentioned features, but also covers other embodiments with any combination of the above-mentioned features or their equivalents without departing from the inventive concept. For example, the above features may be replaced with (but not limited to) features having similar functions disclosed in the present application.

Claims (16)

1. A method for debugging a page, the method comprising:
acquiring a source code of a page to be debugged;
adjusting a path of the resource file referenced in the source code;
encoding the source code after the resource file path is adjusted to obtain page data to be debugged; and
sending the page data to be debugged to a server, wherein the page data to be debugged is distributed to a plurality of terminals to be debugged through the server so that the plurality of terminals to be debugged can decode the received page data to be debugged and generate corresponding pages;
wherein,
the adjusting the path of the resource file referenced in the source code includes:
extracting contents of different types of language structures in source codes of the page;
adjusting a relative path of the resource file referenced in the content of the different types of language structures to an absolute path;
the encoding of the source code after the resource file path adjustment comprises:
and respectively coding different types of language structures after the resource file path is adjusted.
2. The method of claim 1, further comprising:
a connection request is sent to the server to establish two-way communication with the server.
3. The method of claim 1, further comprising:
and responding to the operation of changing the source code of the page to be debugged, and changing the source code of the page to be debugged.
4. A method for debugging a page, the method comprising:
receiving page data to be debugged from a server;
decoding the page data to be debugged; and
generating a corresponding page based on the decoded page data to be debugged;
the page data to be debugged is generated by the control terminal according to the following mode and then is sent to the server:
adjusting the path of a resource file quoted by the acquired source code of the page to be debugged;
encoding the source code after the resource file path is adjusted;
the path adjustment of the resource file which is used for quoting the obtained source code of the page to be debugged comprises the following steps:
extracting contents of different types of language structures in the source code of the page to be debugged;
adjusting a relative path of the resource file referenced in the content of the different types of language structures to an absolute path;
the encoding of the source code after the resource file path adjustment includes:
and respectively coding different types of language structures after the resource file path is adjusted.
5. The method of claim 4,
the decoding the page data to be debugged includes:
decoding the coded different types of language structures;
the generating a corresponding page based on the decoded page data to be debugged includes:
splicing the decoded different types of language structures into corresponding page source codes; and
and generating the corresponding page according to the corresponding page source code.
6. The method according to claim 4 or 5, characterized in that the method further comprises:
a connection request is sent to the server to establish two-way communication with the server.
7. A method for debugging a page, the method comprising:
receiving page data to be debugged sent by a control terminal; and
sending the page data to be debugged to a terminal to be debugged so that the terminal to be debugged decodes the page data to be debugged and generates a corresponding page;
the page data to be debugged is generated by the control terminal according to the following mode: extracting contents of different types of language structures in a source code of a page to be debugged, and adjusting a relative path of a resource file quoted in the contents of the different types of language structures into an absolute path; and respectively coding different types of language structures after the resource file path is adjusted.
8. The method of claim 7, further comprising:
receiving a connection request of the control terminal and the terminal to be debugged; and
and establishing two-way communication with the control terminal and the terminal to be debugged respectively.
9. A terminal for debugging a page, the terminal comprising:
the acquiring unit is used for acquiring a source code of a page to be debugged;
an adjusting unit, configured to adjust a path of the resource file referenced in the source code as follows: extracting contents of different types of language structures in source codes of the page, and adjusting relative paths of resource files quoted in the contents of the different types of language structures into absolute paths;
the encoding unit is used for encoding the source code after the resource file path is adjusted according to the following mode to obtain page data to be debugged: respectively encoding different types of language structures after the resource file path is adjusted; and
the sending unit is used for sending the page data to be debugged to a server;
the page data to be debugged is distributed to a plurality of terminals to be debugged through the server, so that the plurality of terminals to be debugged decode the received page data to be debugged and generate corresponding pages.
10. The terminal of claim 9, wherein the terminal further comprises:
a connection unit for sending a connection request to the server to establish bidirectional communication with the server.
11. The terminal of claim 9, wherein the terminal further comprises:
and the changing unit is used for responding to the operation of changing the source code of the page to be debugged and changing the source code of the page to be debugged.
12. A terminal for debugging a page, the terminal comprising:
the receiving unit is used for receiving page data to be debugged from the server;
the decoding unit is used for decoding the page data to be debugged; and
the generating unit is used for generating a corresponding page based on the decoded page data to be debugged;
the page data to be debugged is generated by the control terminal according to the following mode and then is sent to the server:
adjusting the path of a resource file quoted by the acquired source code of the page to be debugged;
encoding the source code after the path of the resource file is adjusted;
the path adjustment of the resource file which is used for quoting the obtained source code of the page to be debugged comprises the following steps:
extracting contents of different types of language structures in the source code of the page to be debugged;
adjusting a relative path of the resource file referenced in the content of the different types of language structures to an absolute path;
the encoding of the source code after the referenced resource file path is adjusted includes:
and respectively coding different types of language structures after the referenced resource file path is adjusted.
13. The terminal of claim 12,
the decoding unit is used for decoding the page data to be debugged according to the following modes: decoding the coded different types of language structures;
the generating unit is used for generating the corresponding page as follows:
splicing the decoded different types of language structures into corresponding page source codes;
and generating the corresponding page according to the corresponding page source code.
14. The terminal according to claim 12 or 13, characterized in that the terminal further comprises:
a connection unit for sending a connection request to the server to establish bidirectional communication with the server.
15. A server for debugging a page, the server comprising:
the first receiving unit is used for receiving page data to be debugged sent by the control terminal; and
the transmitting unit is used for transmitting the page data to be debugged to the terminal to be debugged so as to enable the terminal to be debugged to decode the page data to be debugged and generate a corresponding page;
the page data to be debugged is generated by the control terminal according to the following mode: extracting contents of different types of language structures in a source code of a page to be debugged, and adjusting a relative path of a resource file quoted in the contents of the different types of language structures into an absolute path; and respectively coding different types of language structures after the resource file path is adjusted.
16. The server of claim 15, further comprising:
the second receiving unit is used for receiving the connection request of the control terminal and the terminal to be debugged; and
and the connecting unit is used for establishing two-way communication with the control terminal and the terminal to be debugged respectively.
CN201510459724.7A 2015-07-30 2015-07-30 For debugging the method, terminal and server of the page Active CN104978277B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201510459724.7A CN104978277B (en) 2015-07-30 2015-07-30 For debugging the method, terminal and server of the page

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201510459724.7A CN104978277B (en) 2015-07-30 2015-07-30 For debugging the method, terminal and server of the page

Publications (2)

Publication Number Publication Date
CN104978277A CN104978277A (en) 2015-10-14
CN104978277B true CN104978277B (en) 2018-12-11

Family

ID=54274806

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201510459724.7A Active CN104978277B (en) 2015-07-30 2015-07-30 For debugging the method, terminal and server of the page

Country Status (1)

Country Link
CN (1) CN104978277B (en)

Families Citing this family (14)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN106815248B (en) * 2015-11-30 2020-07-03 北京国双科技有限公司 Website analysis method and device
CN106878361B (en) * 2015-12-14 2020-08-25 阿里巴巴集团控股有限公司 Debugging method and device for terminal application page and client
CN105808304B (en) * 2016-03-29 2020-06-02 北京小米移动软件有限公司 Code deployment method, device and system
CN105930266B (en) * 2016-04-11 2019-04-16 北京小米移动软件有限公司 Webpage adjustment method and device
CN106126420B (en) * 2016-06-21 2018-12-18 北京小米移动软件有限公司 Application program adjustment method and device
CN107145441B (en) * 2017-04-12 2020-12-29 阿里巴巴(中国)有限公司 Page display method and device
CN108737337B (en) * 2017-04-18 2021-07-27 腾讯科技(深圳)有限公司 Equipment processing method, device, server and system
CN107203470B (en) * 2017-05-11 2018-09-14 腾讯科技(深圳)有限公司 Page adjustment method and device
CN110008182A (en) * 2019-04-15 2019-07-12 山东浪潮云信息技术有限公司 A kind of method that static resource is saved and generated in document
CN110633220A (en) * 2019-09-25 2019-12-31 北京明略软件***有限公司 Debugging information display method and device, storage medium and electronic equipment
CN111061526B (en) * 2019-10-12 2023-12-01 天航长鹰(江苏)科技有限公司 Automatic test method, device, computer equipment and storage medium
CN111142774B (en) * 2019-12-26 2021-12-10 网易(杭州)网络有限公司 Page display method and device
CN111352847A (en) * 2020-03-09 2020-06-30 中国邮政储蓄银行股份有限公司 Real-time debugging method and system for mobile application terminal
CN113419940B (en) * 2021-07-07 2023-08-15 广州方硅信息技术有限公司 Program log acquisition and regression method and corresponding device, equipment and medium thereof

Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103955501A (en) * 2014-04-23 2014-07-30 深圳市赛速科技有限公司 Webpage two-way collaborative browsing method
CN104021077A (en) * 2014-06-10 2014-09-03 广州市久邦数码科技有限公司 Mobile terminal software test system and method
CN104539682A (en) * 2014-12-19 2015-04-22 乐视网信息技术(北京)股份有限公司 Debug method, device, mobile terminal, server and system for mobile webpage

Family Cites Families (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103595742B (en) * 2012-08-14 2017-01-18 阿里巴巴集团控股有限公司 A method and an apparatus for debugging webpage CSS
CN104021082B (en) * 2014-06-16 2017-03-01 贝壳网际(北京)安全技术有限公司 A kind of remote debugging method for browser and device
CN104486333A (en) * 2014-12-11 2015-04-01 北京国双科技有限公司 Debug method and debug device for mobile application programs

Patent Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103955501A (en) * 2014-04-23 2014-07-30 深圳市赛速科技有限公司 Webpage two-way collaborative browsing method
CN104021077A (en) * 2014-06-10 2014-09-03 广州市久邦数码科技有限公司 Mobile terminal software test system and method
CN104539682A (en) * 2014-12-19 2015-04-22 乐视网信息技术(北京)股份有限公司 Debug method, device, mobile terminal, server and system for mobile webpage

Also Published As

Publication number Publication date
CN104978277A (en) 2015-10-14

Similar Documents

Publication Publication Date Title
CN104978277B (en) For debugging the method, terminal and server of the page
CN108337528B (en) Method and equipment for previewing video
CN101610268B (en) Implementation method and equipment of keyword filtration
US9866656B2 (en) System and method for single KVM client accommodating multiple different video compression technologies
US9571556B2 (en) Browser kernel adaptation method and browser therefor
US20140201617A1 (en) Method for Browsing Web Page on Mobile Terminal
CN106874519B (en) Page display method and device
CN108416021B (en) Browser webpage content processing method and device, electronic equipment and readable medium
KR20000053638A (en) Systems, methods and computer program products for tailoring web page content in hypertext markup language format for display within pervasive computing devices using extensible markup language tools
CN113382083B (en) Webpage screenshot method and device
CN105959821A (en) Video play method and device
CN103825772B (en) Identifying user clicks on the method and gateway device of behavior
CN113076294A (en) Information sharing method and device
CN111859210B (en) Image processing method, device, equipment and storage medium
CN114302176B (en) Video playing method and device
US8396920B1 (en) Clean URLs in web applications
CN114297544A (en) Remote browsing method, device, equipment and storage medium
CN112558933A (en) Component rendering method and device, readable medium and electronic equipment
CN113050942A (en) Page generation method and device, readable medium and electronic equipment
US8949375B2 (en) Data processing of media file types supported by client devices
CN106686037B (en) Page detection method, device, equipment and system
KR20110118000A (en) Apparatus for interoperability between web-browser and local-resources in the mobile device and method thereof
CN113515213A (en) Cursor shape synchronization method, remote browsing system, equipment and storage medium
CN112749353A (en) Processing method and device of webpage icon
US10176150B2 (en) Remotely providing fonts for an electronic document

Legal Events

Date Code Title Description
C06 Publication
PB01 Publication
C10 Entry into substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant