PDA

View Full Version : Open new window, get url as variable from parentwin



powerchordpunk
11-21-2006, 05:55 AM
I have a link in my IE7 right click menu, pointing to a local html file. This file takes the url of the page I right clicked on, and forwards it to a proxy server. I can use external.menuArguments.document to get the url of the page, but how would I get the url of a LINK or linked image I clicked on?

Code is as follows; pertinent variables are at the top:

<SCRIPT LANGUAGE="JavaScript" defer>
//Get url
var doc = external.menuArguments.document;
var url = doc.URL;



var regex = /^http:\/\//;

if(! regex.test(url)) {
url = "http://" + url;
}

array1 = url.split("//");
var url=array1[1];

// 1st open a new, 2nd work in the current.
o p e n(window.location.href='https://x.x.x.x/cgi-bin/nph-744506.cgi/000000A/http/'+url); //forum code messes up with "open" for some reason

</SCRIPT>

To clarify, as it is now, If I right click on the "Advanced Search" link (http://www.google.com/advanced_search?hl=en) on google.com, it will only open up google.com in my proxy server. I want it to open up the advanced search page. I hope this makes sense.

Thanks in advance.