/    Sign up×
Community /Pin to ProfileBookmark

Seems Like a Simple Problem…

I’m attempting to add a ‘Tell A Friend’ link to a shopping cart, that would pop up a new window. The content of this new window is generated by the Perl script. Due to the way the cart functions, combined with the opening of the new window, the script is not able to grab the referring URL.

My thought here is to add the referring document’s URL as a query string using some JavaScript, and letting the script take things from there.

Here’s the code I’m using to pop the new window:

<SCRIPT LANGUAGE=JAVASCRIPT>
<!– Hide from older browsers
function refer()
}
window.open(“http://www.xyz.com/cgi/refer.cgi?”, “Refer_a_Friend”, “toolbar=0,location=0,directories=0,status=no,scrollbars=yes,resizable=1,copyhistory=0,width=600,height=400,top=10,left=10”);
}
// End Hiding –>
</SCRIPT>

Now the question is, how can I hack together a string that would tack the location.href value on the end of the url calling the cgi script? I’m sure this can be done, but my knowledge of JavaScript is limited to copy & paste… LOL

Any help would be GREATLY appreciated…

Thanks!

to post a comment
JavaScript

4 Comments(s)

Copy linkTweet thisAlerts:
@Khalid_AliDec 22.2005 — anything that you will append after the question mark in the url should be there for you retrieve on the server side something like this

[b]

"http://www.xyz.com/cgi/refer.cgi?comingfrom=wwww.someurl.com"

[/b]
Copy linkTweet thisAlerts:
@cmopsauthorDec 23.2005 — If I hard code it... but I want the query string to be dynamic, being supplied by the location.href or a similar function. The idea seems simple, but I would need the correct syntax. As I said, this is going into a shopping cart, the link will be on a template page, so the URL will never be constant, SSI can't seem to pull off the job because I'm popping this in a new window.

All I need is the correct way (if it's possible) to insert the location.href value as the query sting. the code, in theory, would look something like this:

<SCRIPT LANGUAGE=JAVASCRIPT>

<!-- Hide from older browsers

function refer()

}

window.open("http://www.xyz.com/cgi/refer.cgi?[COLOR=Red]location.href[/COLOR]", "Refer_a_Friend", "toolbar=0,location=0,directories=0,status=no,scrollbars=yes,resizable=1,copyhistory=0,width=600,heig ht=400,top=10,left=10");

}

// End Hiding -->

</SCRIPT>

Ploblem is, while I have the idea down, I think I'm oversimplifying it, because the random combinations I'm trying aren't working. I'm imagining I just need to get the right combinations of +'s, "'s, and maybe some document.write lines in there.

Again, this is going on a TEMPLATE page for the cart, so nothing can be hard coded, I need to dynamically modify this link to include the query sting of the actual cart generated page that if appears on.

Thanks again, hope you can help...
Copy linkTweet thisAlerts:
@felgallDec 23.2005 — Just move the closing quote and add a + like this to achieve what you want.

window.open("http://www.xyz.com/cgi/refer.cgi?"+location.href, "Refer_a_Friend",
Copy linkTweet thisAlerts:
@cmopsauthorDec 26.2005 — Freakin' Sweet... It worked!!! LOL

Thanks for your help!
×

Success!

Help @cmops spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.6,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,

tipper: @Samric24,
tipped: article
amount: 1000 SATS,
)...