URL masking in JavaScript

Michael Kniskern picture Michael Kniskern · Oct 19, 2010 · Viewed 11.9k times · Source

I currently have the following JavaScript function that will take current URL and concatenate it to another site URL to route it to the appropriate feedback group:

function sendFeedback() {
    url = window.location.href;
    newwin = window.open('http://www.anothersite.com/home/feedback/?s=' + url, 'Feedback');
}

Not sure if this is the proper terminology, but I want to mask the URL in the window.open statement to use the URL from the current window.

How would I be able to mask the window.open URL with the original in JavaScript?

Answer

Ed.C picture Ed.C · Oct 19, 2010

Things you could do:

1- Mask the external site in a html frame inside a document from your site. (for example www.mysite.com/shortUrl/)

2-Send a Location HTTP header (real url will eventually be displayed)

Keep in mind that browsers do their best to show the real address due to phishing concerns.