|
Mailing Lists
|
Home /
Groups /
ColdFusion Talk (CF-Talk)
Javascript calling ColdFusion - will this work?
Author: Dan G. Switzer, II
Short Link: http://www.houseoffusion.com/groups/cf-talk/thread.cfm/threadid:15452#80082
According to the different versions of O'Reilly's "JavaScript: The
Definitive Guide" I've got on my desk it says:
(JavaScript 1.0; Jscript 1.0; ECMAScript v1; deprecated in ECMAScript
v3)
escape()
encode a string
Synopsis
escape(s)
Arguments
s The string that is to be "escaped" or encoded
Returns
An encoded copy of s in which certain characters have been replaced by
hexadecimal escape sequences.
I know I've used it in the past to encode full strings without problem.
I've also found that the JS: Definitive Guide is usually pretty good
about document behavior if it varies between browsers or JS versioning.
-Dan
> > Thane,
>
> > If all you care about is updating a hit counter and not displaying
any
----- Excess quoted text cut - see Original Post for more -----
"http://www.stuffbythane.com/SiteTracker/test2.cfm?in=";
----- Excess quoted text cut - see Original Post for more -----
lack of
----- Excess quoted text cut - see Original Post for more -----
unescape (
> which decodes a urlencoded string ) works on the entire string at
once...
----- Excess quoted text cut - see Original Post for more -----
Author: S. Isaac Dealey
Short Link: http://www.houseoffusion.com/groups/cf-talk/thread.cfm/threadid:15452#80067
----- Excess quoted text cut - see Original Post for more -----
iirc the JavaScript escape() function only works on one character at a
time... so you'd actually have to cycle through the whole string and create
a copy i.e.
for ( x=0 ; x < document.referrer.length ; x++ )
{ sImg += escape(document.referrer.charAt(x); }
At least, this is what I've read in my javascript books... otoh unescape (
which decodes a urlencoded string ) works on the entire string at once...
I think I actually made a urlencodedformat() function in my js libraries...
function urlencodedformat(string) {
var strNew = New String("");
for ( var x = 0 ; x < string.length ; x++ )
{ strNew += escape(string.charAt(x); }
return strNew;
}
hth
Isaac Dealey
Certified Advanced ColdFusion 5 Developer
www.turnkey.to
954-776-0046
Author: Dan G. Switzer, II
Short Link: http://www.houseoffusion.com/groups/cf-talk/thread.cfm/threadid:15452#80026
Thane,
If all you care about is updating a hit counter and not displaying any
code, use the following code:
function Get_Referrer(){
var oCounter = new Image();
var sImg = "http://www.stuffbythane.com/SiteTracker/test2.cfm?in=";
sImg += escape(document.referrer);
sImg += "&out=" + escape(document.location);
oCounter.src = sImg;
}
This will should work in any browser that supports JS v1.1.
NOTE: You previous code may not have been working because of the lack of
the escape() function.
-Dan
> At 10:07 AM 21/08/02 -0400, J
> >Yes that should work, I've used a similar technique for a banner
> >program in the past.
>
> That's what I thought, but it isn't working for me. This is the
complete
----- Excess quoted text cut - see Original Post for more -----
src="http://www.stuffbythane.com/SiteTracker/UpdatePageInfo.js"></script
----- Excess quoted text cut - see Original Post for more -----
something
> wrong.
>
>
T
Author: Thane Sherrington
Short Link: http://www.houseoffusion.com/groups/cf-talk/thread.cfm/threadid:15452#79748
At 10:07 AM 21/08/02 -0400, J
>Yes that should work, I've used a similar technique for a banner
>program in the past.
That's what I thought, but it isn't working for me. This is the complete
code I'm using - three files in total:
Alright, I tried this, but I must be doing something wrong:
Index.htm looks like this:
<html>
<body>
Test page.
<script language="Javascript"
src="http://www.stuffbythane.com/SiteTracker/UpdatePageInfo.js"></script>
</body>
</html>
UpdatePageInfo.js looks like this:
function Get_Referrer() {
document.write("<script language='Javascript'
src='http://www.stuffbythane.com/SiteTracker/test2.cfm?in=" +
document.referrer + "&out=" + document.location + " '>");
document.write("</");
document.write("script>");
}
Get_Referrer();
Test2.cfm looks like this:
<CFQUERY name="test" datasource="SiteTracker">
INSERT INTO Test (In, Out)
VALUES "#URL.In#", "#URL.Out#"
</CFQUERY>
So far as I can tell, test2.cfm doesn't get called. Or if it does, it
doesn't run. Nothing ever ends up in the database, and if I put popup
Window code in test2.cfm, nothing happens. So I must be doing something wrong.
T
Author: Jon Hall
Short Link: http://www.houseoffusion.com/groups/cf-talk/thread.cfm/threadid:15452#79746
Yes that should work, I've used a similar technique for a banner
program in the past.
--
jon
mailto:jonhall@ozline.net
Wednesday, August 21, 2002, 9:37:13 AM, you wrote:
TS> I'm trying to use this code to call a ColdFusion page:
TS> function Get_Referrer() {
TS> document.write("<script language='Javascript'
TS> src='http://www.stuffbythane.com/SiteTracker/test3.cfm?in=" +
TS> document.referrer + "&out=" + document.location + "'>");
TS> document.write("</");
TS> document.write("script>");
TS> }
TS> Get_Referrer();
TS> It doesn't appear to work. Is it possible to do this? I know I could
TS> change test3.cfm to test3.cgi and call a Perl page, but it was suggested
TS> that I could do it with CF as well.
TS> T
Author: Thane Sherrington
Short Link: http://www.houseoffusion.com/groups/cf-talk/thread.cfm/threadid:15452#79743
I'm trying to use this code to call a ColdFusion page:
function Get_Referrer() {
document.write("<script language='Javascript'
src='http://www.stuffbythane.com/SiteTracker/test3.cfm?in=" +
document.referrer + "&out=" + document.location + "'>");
document.write("</");
document.write("script>");
}
Get_Referrer();
It doesn't appear to work. Is it possible to do this? I know I could
change test3.cfm to test3.cgi and call a Perl page, but it was suggested
that I could do it with CF as well.
T
|
May 24, 2012
|
Latest Fusion Authority Articles
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||