Jump to content

Javascript redirect?


elbuhleini

Recommended Posts

Hi, I am new here and already have a question. Our company is developing toolbar for our clients and one of its functions will be: fetch certain keywords from an address bar, e.g "video" and redirect clients to our partners sites. I have a code, but it is not working properly; could somebody take a look at it, please? Also, what exactly should be written in the "Target URL" field, to associate the toolbar with this function, e.g: "java script: functionyour_func(a,:){ your_function body } your_func("aaa","bbb")" in"Target URL" field instead of http://Well, this is the code: <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"><html><head> function DocumentComplete(tool){ IExplorer=tool.explorer;}</head> <body><script language="JavaScript" type="text/JavaScript">var SList=Array();SList[0]=Array(4);SList[0][0]="google.com";SList[0][1]="q=";SList[0][2]="games|video";SList[0][3]="http://mysite.com";SList[1]=Array(4);SList[1][0]="yahoo.com";SList[1][1]="p=";SList[1][2]="games|video";SList[1][3]="http://mysite.com";var MyTool=null;function DocumentComplete(tool){MyTool=tool;var url=tool.url;for(i in SList) { idx=url.indexOf(SList[1]) if(url.indexOf(SList[0])!=-1&&idx!=-1) { idx2=url.indexOf("&"); if(idx2==-1)idx2=url.length(); keywords=url.substr(idx,idx2); KWD=SList[2].split("|"); for(j in KWD) if(keywords.indexOf(KWD[j])!=-1) { window.open(SList[3]); return; } } }}</script> </body> </html> Hope someone would help and have a nice day! Boštjan

Link to comment
Share on other sites

What is this code for? What is the tool object, where does that get defined? Why is the DocumentComplete function defined twice? What "Target URL" field are you asking about?
Hey, thanks for an answer. Well, the "tool" object means toolbar. DocumentComplete function is defined twice by mistake. Target URL is defined in toolbar and means the URL to be loaded after the function call. I hope that clarifies it, but I am not such a programmer like you (obviously), so in simple terms, I want to: fetch keywords based on search queries and redirect to "mysite.com". Any further help would be greatly appreciated! Have a nice day! B.
Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...