Server evaluation of client-side script
Abstract
A facility is described for server-side evaluation of client-side script, such as to crawl and index dynamically generated links. In various embodiments, the facility provides an object that emulates a browser object. The provided object exposes a function for performing steps comprising receiving a first link and storing the received first link in a list of links to be processed. The facility receives a second link to be processed, loads a second document identified by the received second link, and assigns the provided object to a global variable so that a script associated with the loaded second document invokes the function exposed by the provided object instead of a function with a similar name that is exposed by the emulated browser object. The function with the similar name exposed by the emulated browser object handles the received first link without storing it in the list of links to be processed.
Claims
exact text as granted — not AI-modified1 - 20 . (canceled)
21 . A method performed by a server computing device for evaluating a client-side script, comprising:
providing an object that emulates a browser object; assigning the provided object to a global variable having a similar name as the emulated browser object, wherein the function of the object has functionality equivalent to the emulated browser object; detecting a dynamically generated link by the object; adding the dynamically generated link to a link queue; downloading a document associated with the dynamically generated link; and processing contents of the downloaded document.
22 . The method of claim 21 further comprising:
building a document object model based on the downloaded document;
employing the built document object model to locate a script element in the downloaded document; and
executing, at the server computing device, a client-side script defined within the script element.
23 . The method of claim 22 further comprising downloading a second client-side script referenced by an attribute of the script element.
24 . The method of claim 23 wherein the second client-side script referenced by the attribute of the script element is executed before the client-side script.
25 . The method of claim 21 further comprising:
employing a markup language sweeper component to determine if the document is well-formed; and
modifying document tags in the case the document is not well-formed.
26 . The method of claim 21 further comprising triggering events.
27 . The method of claim 26 wherein, for each node in the document object model, the triggering comprises:
determining whether the node indicates an event handler attribute; and
invoking an event handling routine indicated by the event handler attribute.
28 . The method of claim 21 wherein the processing includes crawling and indexing text stored in the downloaded document.
29 . The method of claim 22 further comprising:
detecting an attempt to change the built document object model;
receiving information relating to the attempted change to the built document object model;
determining whether the attempted change identifies a link; and
adding the identified link to the link queue for processing when the attempted change identifies a link.
30 . The method of claim 29 wherein the link is retrieved from the link queue.
31 . A system for evaluating client-side script at a server computing device, comprising:
a link queue to process, each link identifying a document; and a script engine component operating at the server computing device that,
provides an object that emulates a browser object;
assigns the provided object to a global variable having a similar name as the emulated browser object, wherein the function of the object has functionality equivalent to the emulated browser object;
detects a dynamically generated link by the object;
adds the dynamically generated link to a link queue;
downloads a document associated with the dynamically generated link; and
processes contents of the downloaded document.
32 . The system of claim 31 further comprising a document object model component that builds a document object model based on the downloaded document.
33 . The system of claim 32 wherein the document object model component further:
detects an attempt to change the built document object model;
receives information relating to the attempted change to the built document object model;
determines whether the attempted change identifies a link; and
adds the identified link to the link queue for processing when the attempted change identifies a link.
34 . The system of claim 31 further comprising a markup language sweeper component that transforms the identified document into a well-formed document.
35 . The system of claim 31 wherein the script engine processes a client-side script that is written using a language that is similar to a JavaScript language.
36 . The system of claim 31 wherein the received link is dynamically generated by the script.
37 . The system of claim 31 wherein the emulating object emulates a window, location, navigator, cookie, or document browser object.
38 . The system of claim 31 wherein the script employs the global variable as a substitute for the browser object without a change in the script.
39 . A non-transitory computer-readable storage medium having computer-executable instructions that, when executed, cause a server computing system to perform a method of evaluating a client-side script, the method comprising:
providing an object that emulates a browser object; assigning the provided object to a global variable having a similar name as the emulated browser object, wherein the function of the object has functionality equivalent to the emulated browser object; detecting a dynamically generated link by the object; adding the dynamically generated link to a link queue; downloading a document associated with the dynamically generated link; and processing contents of the downloaded document.
40 . The computer-readable medium of claim 39 wherein handling a link includes loading a document referenced by the link.
41 . The computer-readable medium of claim 39 wherein the method further comprises:
building a document object model based on the downloaded document;
employing the built document object model to locate a script element in the downloaded document; and
executing, at the server computing device, a client-side script defined within the script element.
42 . The computer-readable medium of claim 41 wherein the method further comprises:
detecting an attempt to change the built document object model;
receiving information relating to the attempted change to the built document object model;
determining whether the attempted change identifies a link; and
adding the identified link to the link queue for processing when the attempted change identifies a link.Cited by (0)
No later patents cite this yet.
References (0)
No backward citations on record.