[Javascript] capture & redirect URL

Tom Allison tallison at tacocat.net
Thu Jan 5 14:36:41 CST 2006


On 1/5/2006, "Paul Novitski" <paul at novitskisoftware.com> wrote:

>At 07:14 AM 1/5/2006, Tom Allison wrote:
>>I know there are ways to capture href links and rewrite the addresses
>>using a variety of server/proxy side tools.  But I found that these
>>rewrites can't manage the URL's that are in javascript simply because
>>there aren't the regex matches available.
>
>Hi Tom,
>
>The second sentence above reads like it's become derailed from
>reality, so maybe I'm just not understanding what you mean.
>
>1) In my experience the Regular Expression capabilities of
>server-side languages (VBscript and PHP) are greater than or equal to
>those of JavaScript, including the number of regexp matches which we
>receive as arrays with practically unlimited bounds in any language.
>
>2) I wouldn't say that there are any "URLs in javascript" per se;
>we're going to encounter URLs as either text-strings in an HTML page
>or values of HTTP header fields, and in either case they travel down
>the pipe from the server to the client and are therefore accessible
>to both server-side scripts and client-side scripts.  I'd say the
>only things that javascript can see that a server-side script can't
>are the user's actions (on keyboard, mouse, microphone, etc.) between
>download and submit.
>
>I much prefer to redirect pages from a server-side script when user
>interaction isn't a factor.  You can redirect in a single operation
>without forcing a round-trip between server and client, and you can
>rest assured that your redirects will work regardless of whether
>javascript is enabled in the client.
>
>If I'm missing something here because of my limited knowledge of
>proxy servers, please elucidate.
>
>Regards,
>Paul

An example of a URL that I can't capture in the javascript is when the
URL is either a function call or an escaped sequence of characters.   A
simple HEADER regex in perl won't know the results of the function
call.  Now that I think about it, I probably could munge the URL as a
function call by changing the HTTP Headers before they get to the
client.  I would guess starting with HOST might be a good bet.

Isn't there anything out there that's easier to read than the RFC on
this?  I couldn't find Cookies mentioned in the HTTP RFC and I'm not
sure where to go.



More information about the Javascript mailing list