Methods and Systems for Rewriting Scripts to Direct Requests
Abstract
Methods and systems for rewriting scripts by a server system to direct requests generated from the scripts to pass through the server system. The proxy server receives a first request from the user device for a web page provided by a first web server. The proxy server then receives the web page from the first web server in response to the first request. The proxy server processes the web page. For example, the proxy server rewrites a script in the web page to direct requests generated by the script through the proxy server. The proxy server sends the processed web page, including the rewritten script, to the user device.
Interactive Citation Constellation Global Citation Ranking
Interactive SVG Citation Constellation renders in Rust/WebAssembly. Prior art cited: 26 · Forward citations: 0.
Claims (11)
- Claim 1Independent Claim
A method, comprising: at a proxy server having one or more processors and memory storing instructions for execution by the one or more processors, wherein the proxy server is coupled to one or more web servers and a user device: receiving, from the user device, a first request for a web page provided by a first web server; receiving, in response to the first request, the web page from the first web server; determining whether a script in the web page includes any functions that would cause the user device to send a request to a URL; in accordance with a determination that the web page includes one or more functions that would cause the user device to send a request to a URL: processing the web page, comprising rewriting the script in the web page to direct requests generated by the script through the proxy server; and sending the processed web page, including the rewritten script, to the user device.
- Claim 2Depends on #1
The method of claim 1 , wherein the web page is a zero-rated web page that is retrievable by the user device for free.
- Claim 3Depends on #1
The method of claim 1 , further comprising, at the proxy server: in accordance with a determination that the web page includes a first function that would cause the user device to send a request to a URL, replacing the first function with a customized function that directs requests through the proxy server.
- Claim 4Depends on #1
The method of claim 1 , wherein rewriting the script comprises: converting the script into an abstract syntax tree (AST) structure; searching the AST structure to identify any functions that would cause the user device to send a request to a URL; and replacing a first identified function with a call to a customized function that directs a request through the proxy server.
- Claim 5Depends on #4
The method of claim 4 , wherein one or more functions that would cause the user device to send a request to a URL cannot be assigned to customized functions to direct requests through the proxy server, the method further comprising, at the proxy server: providing a list of one or more second functions that can be assigned to customized functions to direct requests through the proxy server; and prior to rewriting the script, determining whether the script comprises any functions from the list; wherein the converting, searching, and causing are performed in accordance with a determination that any functions in the script are not from the list.
- Claim 6Depends on #4
The method of claim 4 , further comprising, at the proxy server, injecting a customized script defining the customized function into the web page.
- Claim 7Depends on #6
The method of claim 6 , wherein the customized script defining the customized functions is injected into a portion of the web page that defines metadata of the web page.
- Claim 8Depends on #1
The method of claim 1 , wherein processing the web page comprises: determining whether the script comprises any functions that would cause the user device to send a request to a URL; and in accordance with a determination that a respective function in the script matches a function that would cause the user device to send a request to a URL, blocking the respective function.
- Claim 9Depends on #1
The method of claim 1 , wherein the script comprises HTML code, and wherein the method further comprises: identifying one or more URLs in the HTML code; and rewriting the one or more URLs to include the identifier of the proxy server.
- Claim 10Depends on #1
The method of claim 1 , further comprising storing the rewritten script in a database of the proxy server.
- Claim 11Depends on #10
The method of claim 10 , further comprising, at the proxy server: receiving a second request for the web page from a requesting device; and responding to the second request, comprising sending the rewritten script of the web page stored in the database to the reques
Technical Overview & Description
TECHNICAL FIELD This relates generally to network communications, including but not limited to rewriting scripts by a server system for directing requests generated from the scripts to pass through the server system. BACKGROUND Mobile devices have become an increasingly dominant means through which consumers access, download, and consume electronic content over the Internet. Despite substantial advancements in telecommunications technology, however, affordable access to the Internet remains relatively low. Considering the limited affordability of Internet access in certain geographic regions, such as developing countries, consumers often have difficulty accessing the Internet and therefore are often left frustrated when using mobile devices. Recently, zero-rated Internet service has become an increasingly popular option to improve the affordability of Internet access. It is beneficial to serve the zero-rated content efficiently and effectively to the consumers. SUMMARY Accordingly, there is a need for methods, devices, and systems for improving network operability, for managing data exchanged between user devices and web servers, and for avoiding data leakage (e.g., a paid data leakage). Embodiments set forth herein are directed to methods, devices, and systems for rewriting scripts of web pages. Zero-rated (e.g., free) access to certain content (e.g., zero-rated content) on the Internet may be provided to users for no cost, while non-zero-rated (e.g., paid) access to other content (e.g., non-zero-rated content) on the Internet may also be offered on other terms. By having a proxy server route traffic exchanged between user devices and web servers, the user devices can access the Internet at predetermined rates or at no cost. The proxy server processes (e.g., rewrites) scripts of web pages received from web servers to ensure that any requests generated from the scripts pass through the proxy server. Thus paid data leakage can be a
Cited By — Indexed Forward Citations (0 of 0 total)
No indexed citing patents in this generation yet. Ingest USPTO/PatentsView bulk citation tables via patents-ingest to expand the local forward citation graph.
References Cited — Backward Prior Art (26)
| Patent | Title | Year | Citations |
|---|
Non-Patent Literature (1)
- About Caja, Feb. 28, 2012, pp. 1-7, (https://developers.google.com/caja/does/about/).