Variables in Java and Javascript
Hey people, New thing: I need to check if a certing browser has java enabled, and javascript can you set a variable in java or javascript and let it be read in cold fusion? this is what i'm thinking: Cfset javascript = 0 cfset java = 0 javacode put 1 into java /javacode javascript code put 1 into javascript /javascript code cfif javascript = 0 no javascript /cfif cfif java = 0 no java /cfif any ideas on how to do this? better then this one? And, if you can cross variables through different peices of code, what is the syntax for writing this in javascript, java? Can you have Java on a cfm page? Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/ Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists or send a message with 'unsubscribe' in the body to [EMAIL PROTECTED]
RE: Variables in Java and Javascript
The javascript would work, yes. The java wouldn't work as you have it because you can only process one server side language per application page. Java and ColdFusion cannot be called on the same page. I do not know if or how you could tell that a broweser is java-enabled. I'd wait and see if Watts responds to this... one can always hope. -Patti -Original Message- From: Gavin Myers [mailto:[EMAIL PROTECTED]] Sent: Wednesday, October 18, 2000 11:07 AM To: CF-Talk Subject: Variables in Java and Javascript Hey people, New thing: I need to check if a certing browser has java enabled, and javascript can you set a variable in java or javascript and let it be read in cold fusion? this is what i'm thinking: Cfset javascript = 0 cfset java = 0 javacode put 1 into java /javacode javascript code put 1 into javascript /javascript code cfif javascript = 0 no javascript /cfif cfif java = 0 no java /cfif any ideas on how to do this? better then this one? And, if you can cross variables through different peices of code, what is the syntax for writing this in javascript, java? Can you have Java on a cfm page? Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/ Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists or send a message with 'unsubscribe' in the body to [EMAIL PROTECTED] Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/ Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists or send a message with 'unsubscribe' in the body to [EMAIL PROTECTED]
RE: Variables in Java and Javascript
Don't know about Java, but this can't be done with JavaScript. CF is server side, and JavaScript is client side. By the time the JavaScript executes, CF has completed all of its execution. There are tags that check to see if JavaScript is enabled, check out CF_aBrowserInfo. Haven't used it yet, but just saw it in the tag gallery yesterday. http://devex.allaire.com/developer/gallery/info.cfm?ID=5FE4539E-504A-11D4-AA A000508B94F380method=Full Evan -Original Message- From: Gavin Myers [mailto:[EMAIL PROTECTED]] Sent: Wednesday, October 18, 2000 11:07 AM To: CF-Talk Subject: Variables in Java and Javascript Hey people, New thing: I need to check if a certing browser has java enabled, and javascript can you set a variable in java or javascript and let it be read in cold fusion? this is what i'm thinking: Cfset javascript = 0 cfset java = 0 javacode put 1 into java /javacode javascript code put 1 into javascript /javascript code cfif javascript = 0 no javascript /cfif cfif java = 0 no java /cfif any ideas on how to do this? better then this one? And, if you can cross variables through different peices of code, what is the syntax for writing this in javascript, java? Can you have Java on a cfm page? -- -- Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/ Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists or send a message with 'unsubscribe' in the body to [EMAIL PROTECTED] Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/ Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists or send a message with 'unsubscribe' in the body to [EMAIL PROTECTED]
RE: Variables in Java and Javascript
browserhawk can catch enabled/disabled Java. http://www.browserhawk.com/products/bhawk/features.asp AJ -Original Message- From: Patricia Lee [mailto:[EMAIL PROTECTED]] Sent: Wednesday, October 18, 2000 11:33 AM To: CF-Talk Subject: RE: Variables in Java and Javascript The javascript would work, yes. The java wouldn't work as you have it because you can only process one server side language per application page. Java and ColdFusion cannot be called on the same page. I do not know if or how you could tell that a broweser is java-enabled. I'd wait and see if Watts responds to this... one can always hope. -Patti -Original Message- From: Gavin Myers [mailto:[EMAIL PROTECTED]] Sent: Wednesday, October 18, 2000 11:07 AM To: CF-Talk Subject: Variables in Java and Javascript Hey people, New thing: I need to check if a certing browser has java enabled, and javascript can you set a variable in java or javascript and let it be read in cold fusion? this is what i'm thinking: Cfset javascript = 0 cfset java = 0 javacode put 1 into java /javacode javascript code put 1 into javascript /javascript code cfif javascript = 0 no javascript /cfif cfif java = 0 no java /cfif any ideas on how to do this? better then this one? And, if you can cross variables through different peices of code, what is the syntax for writing this in javascript, java? Can you have Java on a cfm page? Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/ Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists or send a message with 'unsubscribe' in the body to [EMAIL PROTECTED] Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/ Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists or send a message with 'unsubscribe' in the body to [EMAIL PROTECTED] Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/ Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists or send a message with 'unsubscribe' in the body to [EMAIL PROTECTED]
RE: Variables in Java and Javascript
You can't put CF and ASP on the same page, unfortunately. In CF, you can do a detection for Java/JS as shown below, and redirect the user accordingly. As long as the java is an applet loaded client side, you're fine, you can just call it as you normally would. In order to get information, though, from the java applet or the wddx recordset to the CF Server, you'll need to do an HTTP request, either appending it to the URL querystring(HTTP GET), or using either a form on the page(in the case of javascript), or methods in Java(HTTP POST). With Javascript, you'll want to reserialize your recordset and drop it in a hidden form field before submitting. cfif not isDefined('session.reloads') cfset session.reloads=0 /cfif cfif isDefined('url.java') cfset session.java=url.java cfset session.reloads=session.reloads+1 /cfif cfif isDefined('url.js') cfset session.js=url.js cfset session.reloads=session.reloads+1 /cfif cfif isDefined('url.reload') cfset session.reloads=session.reloads+1 cfif not isDefined('session.java') cfset session.java=0 /cfif cfif not isDefined('session.js') cfset session.js=0 /cfif Point the browser to the scriptless site. /cfif meta http-equiv="Refresh" content="3, thispage.cfm?reload=true" cfif not isDefined(session.java) Use java client side to tell the browser to call this same page href='thispage.cfm?java=1'; /cfif cfif not isDefined('session.js') script location.href="thispage.cfm?js=1"; /script /cfif That way, you get 3 blinky reloads and you have all the info you need to move the user to the correct portion/format of your site. -Original Message- From: Evan Lavidor [mailto:[EMAIL PROTECTED]] Sent: Wednesday, October 18, 2000 12:02 PM To: CF-Talk Subject: RE: Variables in Java and Javascript Don't know about Java, but this can't be done with JavaScript. CF is server side, and JavaScript is client side. By the time the JavaScript executes, CF has completed all of its execution. There are tags that check to see if JavaScript is enabled, check out CF_aBrowserInfo. Haven't used it yet, but just saw it in the tag gallery yesterday. http://devex.allaire.com/developer/gallery/info.cfm?ID=5FE4539E-504A-11D4-AA A000508B94F380method=Full Evan -Original Message- From: Gavin Myers [mailto:[EMAIL PROTECTED]] Sent: Wednesday, October 18, 2000 11:07 AM To: CF-Talk Subject: Variables in Java and Javascript Hey people, New thing: I need to check if a certing browser has java enabled, and javascript can you set a variable in java or javascript and let it be read in cold fusion? this is what i'm thinking: Cfset javascript = 0 cfset java = 0 javacode put 1 into java /javacode javascript code put 1 into javascript /javascript code cfif javascript = 0 no javascript /cfif cfif java = 0 no java /cfif any ideas on how to do this? better then this one? And, if you can cross variables through different peices of code, what is the syntax for writing this in javascript, java? Can you have Java on a cfm page? -- -- Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/ Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists or send a message with 'unsubscribe' in the body to [EMAIL PROTECTED] Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/ Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists or send a message with 'unsubscribe' in the body to [EMAIL PROTECTED] Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/ Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists or send a message with 'unsubscribe' in the body to [EMAIL PROTECTED]
RE: Variables in Java and Javascript
why not just do: cfwddx action="CFML2JS" input="#javascript_verify#" toplevelvariable="javascript_final_verify" output="javascript_final_verify" instead of CFML2WDDX, WDDX2JS ? ~Simon -Original Message- From: Gavin Myers [mailto:[EMAIL PROTECTED]] Sent: Wednesday, October 18, 2000 12:22 PM To: CF-Talk Subject: RE: Variables in Java and Javascript What i've been looking into is cfwddx, i think its my only hope: cfset javascript_verify = 0 cfwddx action="CFML2WDDX" input="#javascript_verify#" output = "javascript_verify_wddx" cfwddx action="WDDX2JS" input="#javascript_verify_wddx#" toplevelvariable="javascript_final_verify" output="javascript_final_verify" SCRIPT LANGUAGE="JAVASCRIPT" CFOUTPUT#javascript_final_verify#/CFOUTPUT !-- document.write((javascript_final_verify = 1)); document.write((javascript_final_verify)); //-- /SCRIPT brBrbr cfoutput#javascript_final_verify#/cfoutput the problem is I cant carry this number from js back to cf. Any suggestions on this? Or is it because js is a broswer lang, you cant go back to running cf again? By using cfwddx, can i then put java and asp on the same page? -Original Message- From: Patricia Lee [mailto:[EMAIL PROTECTED]] Sent: Wednesday, October 18, 2000 10:33 AM To: CF-Talk Subject: RE: Variables in Java and Javascript The javascript would work, yes. The java wouldn't work as you have it because you can only process one server side language per application page. Java and ColdFusion cannot be called on the same page. I do not know if or how you could tell that a broweser is java-enabled. I'd wait and see if Watts responds to this... one can always hope. -Patti -Original Message- From: Gavin Myers [mailto:[EMAIL PROTECTED]] Sent: Wednesday, October 18, 2000 11:07 AM To: CF-Talk Subject: Variables in Java and Javascript Hey people, New thing: I need to check if a certing browser has java enabled, and javascript can you set a variable in java or javascript and let it be read in cold fusion? this is what i'm thinking: Cfset javascript = 0 cfset java = 0 javacode put 1 into java /javacode javascript code put 1 into javascript /javascript code cfif javascript = 0 no javascript /cfif cfif java = 0 no java /cfif any ideas on how to do this? better then this one? And, if you can cross variables through different peices of code, what is the syntax for writing this in javascript, java? Can you have Java on a cfm page? Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/ Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists or send a message with 'unsubscribe' in the body to [EMAIL PROTECTED] Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/ Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists or send a message with 'unsubscribe' in the body to [EMAIL PROTECTED] Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/ Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists or send a message with 'unsubscribe' in the body to [EMAIL PROTECTED] Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/ Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists or send a message with 'unsubscribe' in the body to [EMAIL PROTECTED]
RE: Variables in Java and Javascript
I do not know if or how you could tell that a broweser is java-enabled. I'd wait and see if Watts responds to this... one can always hope. You can use JavaScript, if it's on, to see if the browser supports Java: script language="JavaScript" if (navigator.javaEnabled()) { alert('You have Java!'); } /script Of course, if JavaScript is off, then good luck! Dave Watts, CTO, Fig Leaf Software http://www.figleaf.com/ voice: (202) 797-5496 fax: (202) 797-5444 Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/ Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists or send a message with 'unsubscribe' in the body to [EMAIL PROTECTED]
RE: Variables in Java and Javascript
I don't understand this all that well. I'll say this in my own words and if this is what you need, I think I have a possible solution. User scenario: Johnny Foo clicks on a link that points to http://server/directory/page1.cfm CF server processes page1.cfm and in the process, creates a JavaScript variable. Web server sends resulting page back Johnny Foo receives a page1.cfm in HTML format, and because it contains Javascript, it will be executed, computing a variable. Then... Scenario 1a You would like to call http://server/directory/page2.cfm?variable=1 without Johnny knowing it, and without changing the page. Solution: I have a trick to do that. or Scenario 1b You would like to call http://server/directory/page2.cfm?variable=1 and then have Johnny receive page2.cfm in HTML format. use window.location = 'http://server/directory/page2.cfm?variable='+jsvariable after you compute jsvariable. Make sure page1.cfm has no HTML output. The user will see a white page for a second. Or put a nice short message in page1 that will, at best, flash momentarily. Jaime/ -Original Message- From: Gavin Myers [mailto:[EMAIL PROTECTED]] Sent: Wednesday, October 18, 2000 9:22 AM To: CF-Talk Subject: RE: Variables in Java and Javascript What i've been looking into is cfwddx, i think its my only hope: cfset javascript_verify = 0 cfwddx action="CFML2WDDX" input="#javascript_verify#" output = "javascript_verify_wddx" cfwddx action="WDDX2JS" input="#javascript_verify_wddx#" toplevelvariable="javascript_final_verify" output="javascript_final_verify" SCRIPT LANGUAGE="JAVASCRIPT" CFOUTPUT#javascript_final_verify#/CFOUTPUT !-- document.write((javascript_final_verify = 1)); document.write((javascript_final_verify)); //-- /SCRIPT brBrbr cfoutput#javascript_final_verify#/cfoutput the problem is I cant carry this number from js back to cf. Any suggestions on this? Or is it because js is a broswer lang, you cant go back to running cf again? By using cfwddx, can i then put java and asp on the same page? -Original Message- From: Patricia Lee [mailto:[EMAIL PROTECTED]] Sent: Wednesday, October 18, 2000 10:33 AM To: CF-Talk Subject: RE: Variables in Java and Javascript The javascript would work, yes. The java wouldn't work as you have it because you can only process one server side language per application page. Java and ColdFusion cannot be called on the same page. I do not know if or how you could tell that a broweser is java-enabled. I'd wait and see if Watts responds to this... one can always hope. -Patti -Original Message- From: Gavin Myers [mailto:[EMAIL PROTECTED]] Sent: Wednesday, October 18, 2000 11:07 AM To: CF-Talk Subject: Variables in Java and Javascript Hey people, New thing: I need to check if a certing browser has java enabled, and javascript can you set a variable in java or javascript and let it be read in cold fusion? this is what i'm thinking: Cfset javascript = 0 cfset java = 0 javacode put 1 into java /javacode javascript code put 1 into javascript /javascript code cfif javascript = 0 no javascript /cfif cfif java = 0 no java /cfif any ideas on how to do this? better then this one? And, if you can cross variables through different peices of code, what is the syntax for writing this in javascript, java? Can you have Java on a cfm page? Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/ Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists or send a message with 'unsubscribe' in the body to [EMAIL PROTECTED]
RE: Variables in Java and Javascript - Fixed -
Thanks for all of your inputs. I actually wound up doing this: demo_verify_javascript.cfm noscript cfoutput meta http-equiv="refresh" content="0; URL=error_javascript.cfm" /cfoutput /noscript demo_verify_java.cfm script language = "javascript" document.write("navigator.javaEnabled(): B" + navigator.javaEnabled() + "/BBR"); if (navigator.javaEnabled() == "0") { location = "error_java.cfm" } /script then cfincluded them on the pages that need to test for this stuff, does anyone forsee a problem doing it this way? One thing is that each page that needs java, also needs javascript, so if they have them both disabled then they will get redirected to the javascript page Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/ Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists or send a message with 'unsubscribe' in the body to [EMAIL PROTECTED]