METHOD AND APPARATUS FOR DISTRIBUTED SCRIPT PROCESSING
An approach is provided for providing a low-power browsing experience on a mobile device. A proxy platform receives a request for a webpage. The proxy platform also receives information about the mobile device. The proxy platform processes and/or facilitates a processing of the information about the mobile device and sends the webpage to the mobile device in a format that is based on the information about the mobile device. The mobile device may then operate in a low-power mode when browsing the requested website.
1 . A method comprising facilitating a processing of and/or processing (1) data and/or (2) information and/or (3) at least one signal, the (1) data and/or (2) information and/or (3) at least one signal based, at least in part, on the following:
a request, from a device to a proxy server, for rendering web content including one or more scripts;
a processing of the web content, the one or more scripts, or a combination thereof to cause, at least in part, a determination of (a) whether to reuse media previously stored at the device for rendering the web content; (b) whether to generate a partial update of the web content; (c) whether to cause, at least in part, a processing of at least a portion of the web content, the one or more scripts, or a combination thereof using one or more local resources of the device; or (d) a combination thereof; and
at least one determination to cause, at least in part, the rendering of the web content based, at least in part, on the determination for transmission to the device.
2 . A method of claim 1 , wherein the (1) data and/or (2) information and/or (3) at least one signal are further based, at least in part, on the following:
a processing of the request to determine an address associated with the web content;
a first media list associated with one or more previous requests related to the address associated with the web content;
a generation of a second media list associated with the request; and
at least one determination of whether to reuse the media previously stored at the device based, at least in part, on a comparison of the first media list and the second media list.
3 . A method of claim 2 , wherein the (1) data and/or (2) information and/or (3) at least one signal are further based, at least in part, on the following:
at least one determination that the request specifies, at least in part, a new address associated with the web content; and
a clearing of the first media list, the second media list, or a combination thereof.
4 . A method of claim 1 , wherein the media previously stored at the device is maintained across a plurality of web content requests.
5 . A method of claim 1 , wherein the (1) data and/or (2) information and/or (3) at least one signal are further based, at least in part, on the following:
a storage of a first document object model associated with the web content rendered prior to receiving the request;
a processing of the request to render a second document object model associated with the web content; and
at least one determination of one or more nodes of the first document object model, the second document object model, or a combination thereof that have changed based, at least in part, on a comparison of the first document object model and the second document object model,
wherein the partial update of the web content is based, at least in part, on the one or more nodes that have changed.
6 . A method of claim 5 , wherein the (1) data and/or (2) information and/or (3) at least one signal are further based, at least in part, on the following:
a ratio of the one or more nodes that have changed to the one or more nodes that have not changed; and
at least one determination of whether to generate the partial update based, at least in part, on a comparison of the ratio to one or more threshold values.
7 . A method of claim 5 , wherein the (1) data and/or (2) information and/or (3) at least one signal are further based, at least in part, on the following:
at least one determination that the one or more nodes that have changed are associated with a subset of one or more attributes, one or more tags, one or more whitespaces, or a combination; and
at least one determination to ignore the one or more nodes associated with the subset when determining whether to generate the partial update.
8 . A method of claim 1 , wherein the one or more local resources of the device include, at least in part, one or more local scripting functions, and wherein the (1) data and/or (2) information and/or (3) at least one signal are further based, at least in part, on the following:
at least one determination of a first portion of the one or more scripts that can be performed by the one or more scripting functions, a second portion of the one or more scripts that cannot be performed by the one or more scripting functions, or a combination thereof; and
a generation of a document object model for the rendering of content that includes the first portion for local execution, the second portion for execution at the proxy server, or a combination thereof.
9 . A method of claim 8 , wherein the (1) data and/or (2) information and/or (3) at least one signal are further based, at least in part, on the following:
at least one determination of one or more timers associated with executing the first portion of the one or more scripts, the second portion of the one or more scripts, or a combination thereof,
wherein the one or more timers are managed at the device.
10 . A method of claim 1 , wherein the one or more local resources of the device include one or more native device functions including, at least in part, geolocation, and wherein the (1) data and/or (2) information and/or (3) at least one signal are further based, at least in part, on the following:
at least one determination that the one or more scripts access the one or more native device functions; and
at least one determination to cause, at least in part, the device to provide the one or more native device functions for execution of the one or more scripts.
11 . An apparatus comprising:
at least one processor; and
at least one memory including computer program code for one or more programs,
the at least one memory and the computer program code configured to, with the at least one processor, cause the apparatus to perform at least the following,
receive a request, from a device to a proxy server, for rendering web content including one or more scripts;
process and/or facilitate a processing of the web content, the one or more scripts, or a combination thereof to cause, at least in part, a determination of (a) whether to reuse media previously stored at the device for rendering the web content; (b) whether to generate a partial update of the web content; (c) whether to cause, at least in part, a processing of at least a portion of the web content, the one or more scripts, or a combination thereof using one or more local resources of the device; or (d) a combination thereof; and
cause, at least in part, the rendering of the web content based, at least in part, on the determination for transmission to the device.
12 . An apparatus of claim 11 , wherein the apparatus is further caused to:
process and/or facilitate a processing of the request to determine an address associated with the web content;
determine a first media list associated with one or more previous requests related to the address associated with the web content;
cause, at least in part, a generation of a second media list associated with the request; and
determine whether to reuse the media previously stored at the device based, at least in part, on a comparison of the first media list and the second media list.
13 . An apparatus of claim 12 , wherein the apparatus is further caused to:
determine that the request specifies, at least in part, a new address associated with the web content; and
cause, at least in part, a clearing of the first media list, the second media list, or a combination thereof.
14 . An apparatus of claim 11 , wherein the media previously stored at the device is maintained across a plurality of web content requests.
15 . An apparatus of claim 11 , wherein the apparatus is further caused to:
cause, at least in part, a storage of a first document object model associated with the web content rendered prior to receiving the request;
process and/or facilitate a processing of the request to render a second document object model associated with the web content; and
determine one or more nodes of the first document object model, the second document object model, or a combination thereof that have changed based, at least in part, on a comparison of the first document object model and the second document object model,
wherein the partial update of the web content is based, at least in part, on the one or more nodes that have changed.
16 . An apparatus of claim 15 , wherein the apparatus is further caused to:
determine a ratio of the one or more nodes that have changed to the one or more nodes that have not changed; and
determine whether to generate the partial update based, at least in part, on a comparison of the ratio to one or more threshold values.
17 . An apparatus of claim 15 , wherein the apparatus is further caused to:
determine that the one or more nodes that have changed are associated with a subset of one or more attributes, one or more tags, one or more whitespaces, or a combination; and
determine to ignore the one or more nodes associated with the subset when determining whether to generate the partial update.
18 . An apparatus of claim 11 , wherein the one or more local resources of the device include, at least in part, one or more local scripting functions, and wherein the apparatus is further caused to:
determine a first portion of the one or more scripts that can be performed by the one or more scripting functions, a second portion of the one or more scripts that cannot be performed by the one or more scripting functions, or a combination thereof; and
cause, at least in part, a generation of a document object model for the rendering of content that includes the first portion for local execution, the second portion for execution at the proxy server, or a combination thereof.
19 . An apparatus of claim 18 , wherein the apparatus is further caused to:
determine one or more timers associated with executing the first portion of the one or more scripts, the second portion of the one or more scripts, or a combination thereof,
wherein the one or more timers are managed at the device.
20 . An apparatus of claim 11 , wherein the one or more local resources of the device include one or more native device functions including, at least in part, geolocation, and wherein the apparatus is further caused to:
determine that the one or more scripts access the one or more native device functions; and
determine to cause, at least in part, the device to provide the one or more native device functions for execution of the one or more scripts.