Coldfusion, Javascript & Ampersands?

Hi Folks,

I've hit a bit of a stumbling block here and would appreciate your help.

I'm trying to pass a link between 3 sites, and the links include various parameters.  I need to use a mix of cflocation and javascript window.location (the JS required because that page also has a cfflush).

Here's an example of the workflow;

// index.cfm \\

<cfset link1 = 'http://www.domain.cfm?param1=1¶m2=2'>
<cflocation url="http://otherdomain.com/track.cfm?link=#link1#">

// track.cfm \\

<cfset link2 = '#url.link#'>
<cfflush>
<script type="text/javascript">
window.location = "<cfoutput>#link2#</cfoutput>"
</script>

This works fine, except that anything after the '&' isn't being passed.  So, the destination is only going as far as http://www.domain.cfm?param1=1

A bit of googling suggests this is a known issue, and I need to somehow escape it - but I'm not entirely sure how!

Any help would be much appreciated!
ReveroomAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

erikTsomikSystem Architect, CF programmer Commented:
all you need to do is to use evaluate

<cfset link2 = '#url.link#'>
<cfflush>
<script type="text/javascript">
window.location = "<cfoutput>#Evaluate(DE(Link2))#</cfoutput>"
</script>
0
ReveroomAuthor Commented:
Thanks for the swift reply, erik.

It's still not working for me however.  If I do a straight cflocation to the destination url, it works fine.  However, if I do it via the 'middle domain' (which uses the window.location), it's still stripping everything after (and including) the ampersand.
0
erikTsomikSystem Architect, CF programmer Commented:
try to use
location.replace
or
href.location
0
Big Business Goals? Which KPIs Will Help You

The most successful MSPs rely on metrics – known as key performance indicators (KPIs) – for making informed decisions that help their businesses thrive, rather than just survive. This eBook provides an overview of the most important KPIs used by top MSPs.

ReveroomAuthor Commented:
Hi erik,

Still the same result - have tried both alternatives without success.
0
erikTsomikSystem Architect, CF programmer Commented:
what browser are using .. try using different browser so we can see if this just a browser compatability issue
0
ReveroomAuthor Commented:
Tried on both Firefox (Mac) and IE 7 (Win) - same result on both
0
SidFishesCommented:
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
ReveroomAuthor Commented:
Thanks, SidFishes - that did indeed solve the problem!  Much appreciated.

Thanks to erik once again too, your input is appreciated.
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
ColdFusion Language

From novice to tech pro — start learning today.