CFCLIENT: Doc examples don't work; Can't get anything to work?

Then I realize that the new mobile features CF11 was received with some very mixed reviews, but I wanted to try to see if I could use for some really simple device detection, but I can't get anything to actually work.

For example, I'm looking at the doc for cfclientsettings, specifically in the first example on the page under the heading "Detection devices. Here is the code for reference (I formatted it a bit to make sure it's easy to read here):

<cfClientSettings detectDevice=true />

<cfclient>

<cffunction access="public" name="showCanvasSupport" returntype="void">

<cfsetevalStr = "document.getElementById('canvas').innerHTML='" & cfclient.canvas & "'">

</cffunction>

</cfclient>

Canvas support -<b id="canvas"></b><br>

<button onclick="invokeCFClientFunction('showCanvasSupport',null)">Show canvas support< / button >

Create a new .cfm page and adding this code produce the text and a button on the page, but clicking on the button launches a JS error in Chrome: "Eception the signature of the function is invokeCFClientFunction (nomfonction [, arg1, arg2, arg3,...], successCallback, failureCallback).» The functionName, the successCallback and the failureCallback are mandatory. If you don't have a successCallback or failureCallback, null can be passed as value. »

OK, not very well.  So I checked a few docs more and decided to add another argument null to invokeCFClientFunction() call to correct the lack of recall.  This fixes at least the JS error, but now nothing happens when you click the button.

So after a few more bother, I arrived at the following code, which does not always work, but that seems closer:

<cfClientSettings detectDevice=true />

<cfclient>

<cffunction access="public" name="showCanvasSupport" returntype="void">

< cfscript >

document.getElementById('canvas').innerHTML=cfclient.canvas;

< / cfscript >

</cffunction>

</cfclient>

Canvas support -<b id="canvas"></b><br>

<button onclick="invokeCFClientFunction('showCanvasSupport',null,null)">Show canvas support< / button >

So, copy the following code, when you click the button, sets the innerHTML of the element canvas to "undefined". Awesome.

Honestly, I've tried all the examples that I can find to use cfclient and NONE of them work. Is there some secret I'm missing? I have a sneaking suspicion that if I don't creates a 'Mobile project' in the CFBuilder which does not have anything like that? If yes it is stupid and that they state that in the docs really.

What I'm trying to do, in the end, is just to use cfclient for a simple detection of devices and to enter the width of the browser/device to do some basic detection style query media love in "Using media queries" section of the cfclientsettings doc.  I want to just retrieve the width and then define a variable session based on it.

I use a developer version fully patched for CF11 on my machine Win7 with IIS configuration. Any help is welcome.

Post edited by: Andrew Regis Fixed some spelling/grammar mistakes!

After hitting my head on my keyboard for a while more, I got the job of scope cfclient.

I finally found this page in the docs: detect devices

At first glance, this page seems almost identical to the page of doc cfclientsettings , even having the same code examples.

However, where the cfclientsettings doc uses the scope as this:

cfclient.canvas

Detect devices doc page, he writes like this:

cfclient.properties.canvas

Boom. Of course, that's all it took. What a waste of time. All the cfclient scope variables of work very well if you add '.properties' in there.

I still don't know if the doc cfclientsettings is simply false, or if it is referencing in a different context. I'll definitely add a comment to him on this point.

(In addition, the JavaScript code still does not for this example on both versions of the doc, so there is that.)

Hope this helps someone who wants to make simple customer ColdFusion detection devices.

Tags: ColdFusion

Similar Questions

  • I can't delete the post of WinRar on my files that were downloaded and now I can't get anything to open

    original title: open my files

    I can't delete the post of WinRar on my files that were downloaded and now I can't get anything to open

    Please describe your problem in more detail. Tell us that that "cannot delete" means. Exactly how do you try? What happens when you try? If you get an error message, please quote verbatim.

    Or do you mean 'change' expansion, rather than "delete." Have you tried?

    And one last point: If the files have the rar extension, what are rar files. The file format does not remove or change the extension.  If you remove or change the extension, they will always be rar files. A rar file can only be successfully opened by Winrar or a compatible program.

  • Error message Popup Wuauclt.exe has encountered a problem and need to close. Send the error message or not. I've done both and can't get this popup go away

    A few days ago, I downloaded SP3 on my windows XP computer. and update the windows installer, eversince, then I have a reception an annoying popup message, which reads as follows: Wuauclt has encountered a problem and needs to close > we're sorry for the inconvenience. SEND a MESSAGE ERROR / DON "T SEND I have highlighted both send and not a thousand times and can't get rid of this annoying popup."
    What can I do

    Hi AgnesBradshaw,
     
    Follow the steps in the article to resolve the problem:
     
  • New Nuisance-don't start can not get rid of

    About two weeks ago, something new has appeared on my screen while booting (starting).  It's one of these screens for approval, asking if I would allow some programs can visit his profile (or modify) to my computer.  I have attached a picture for you to watch; However, it is basically said above "User account settings command" followed by "a tool to facilitate the development of services for Windows NT", ending with verified Publisher "Microsoft Windows".  My first question: is this form legitimate and how can I get rid of him.  For the record, I always click 'No' and it disappears.  I have nothing to do with Windows NT that I am running on Windows 7.  I tried to go in msconfig.exe to see if I can spot a start activity that may be relevant; I can't find anything even by looking at the Control Panel programs and features that may be relevant; again I don't find anything.  Although I only classify this problem as a nuisance, I'm tired to see.  Help... Any ideas?

    HA! Your suggested link solves the problem.  Thank you.  What I discovered, it was all antivirus suggestions did not help; However, a comment many done people captured my attention.  Most argued that what happened just after the installation or to top Garmin Express.  A few weeks before the flight on our Thanksgiving trip, I did an update Garmin Express which included also the download of new maps for the United States I am so now gone in msconfig.exe and unchecked Garmin Express in the startup list, and of course the problem disappeared.  The problem is Garmin Express.

  • My search bar is messed up after update. I want the old drop-down list back. I can't get anything now. Firefox is absolutely useless for me now.

    Update of the Firefox software appeared. I allowed him to be installed. He wrecked the bar/search box. I use to be able to click on the magnifying glass icon and ALL options would seem the search engine and I could easily chose a. It has been easy. Now, nothing. I can't find anything through Firefox. Firefox is useless to me now, which means I have no computer. I have to go out and spend another $ 1,000 to get a new computer? This is not good. You shouldn't do that to a person. Not everyone is technically advanced that some of you are. Now, I have no means to look for anything with Firefox. I really liked Firefox. Now your a software update messed me all this. So what should I do? IE is worthless. Not sure, not sure, can not trust him. Never works right. May not print correctly. Update Firefox shouldn't have messed up my computer. I need to search and now I can't. I mean, it's really not good. So, just for you called brilliant Stanford types, when I click on the magnifying glass icon or the small, inverted triangle, there is nothing. The search bar is empty. White, white. Is no longer the quick menu drop-down window with all of the available selections of search engine. I have it? That's why I told myself. Have a real nice day!

    See this article to find out how the new search bar works - https://support.mozilla.org/en-US/kb/search-bar-add-change-manage-search-engines-firefox

    If you want that the old regime back for that search bar.
    Open Subject: config (typed in the address bar) and turn this false preference
    browser.search.showOneOffButtons
    Then restart Firefox.

  • How is my scanner is registered, but I can't get anything to happen when I hit the scan document on my printer

    I can't scan anything

    Hello, Bret and Lisa,

    Printer brand and model, if you please.

    You receive error messages when you try to scan?

    Have you tried to uninstall/reinstall the software?

    Open Device Manager and right-click on the scanner driver

    Select uninstall

    Restart and try again scanner

    The problems of scanning

    http://Windows.Microsoft.com/en-us/Windows-Vista/Troubleshoot-scanning-problems

  • Downloaded the wrong program Design CS6 Standard instead of Photoshop CS6 extended. Stopped downloading to half way through. How can I fix this problem I can't get anything to work?

    How can I download the program I bought and delete the downloaded program wrongly to my Mac laptop?

    Hello

    You can uninstall the wrong program to Go--> Applications. If she is not fully installed and you do not see an uninstall program you can trash the file.

    Please visit the link given to install Photoshop CS6 extended: applications download Creative Suite 6

    It will be useful.

    Concerning

    Bianka Attre

  • Well I'm done typing, how can I get out of it?

    Click another tool, wonderful, what about shortcuts?

    When I finished typing something, I'd love to rather just press two buttons drag the mouse to a tool that I need not just to complete the type. Is really the only way out?

    Enter (not back).

  • I can't get anything to download... the window in the top left corner after double clicking on the THUMB or SAVE the window does not appear.

    This happened after I stupidly deleted some programs I thought that no need to free up space.

    is the preference to show the downloads window download boot enabled in firefox > options > general?

    You can also try resetting firefox (this will keep your bookmarks and passwords).

  • I just bought an Airport Extreme and try to put in place.  I have Fios cable with a router.  I can not get anything except a blinking orange light.  After reading the instructions, it seems that the problem with the ethernet cable but I

    Must not exceed the flashing orange light.  have tried three ethernet cables to the Fios router.  All thoughts

    What extreme version do you have?

    Test the cables connecting the airport to your Mac with them and see if the ethernet works on Mac. Green connectivity light should go... If it fails, then the AE died.

    Please do a factory reset, then try again.

    Sometimes Mac airport utility works well... If you have the preference or iphone ipad, download and use iOS version airport utility and try it for configuration... It is much less awkward.

  • I need help with my streets &amp; trips, and I can't get anything to recognize my product key

    I get the error oxc004d301, tried the help site and nothing works.

    Hello

    I suggest post you you question in Streets and Trips forum for better support.

    http://social.Microsoft.com/forums/en-us/streetsandtrips/threads

  • I can't get anything to print even after the installation of the new CD of the printer and it says ready but does not print. Printer EPSON Stylus NX400 computer desk is Dell.

    Cannot get from my Dell printer.  I hooked but searching the Web for the installation of the printer comes with nothing.

    Hi Velma Brown,

    I see that you can not print. I'll help you with this problem.

    1. What is the model number of the computer?

    2. what security software is installed on the computer?

    3. have you made changes on the computer recently?

    4. What is the exact error you get when you try to print?

    You can download the drivers for the printer Epson here: http://www.epson.com/cgi-bin/Store/support/supDetail.jsp?oid=106004&infoType=Downloads&platform=OSF_W_XP-32

    I suggest you to refer to this article and check if that helps.

    Resources for the resolution of the printer in Windows XP problems: http://support.microsoft.com/kb/308028

    Refer.

    Solve printer problems: http://windows.microsoft.com/en-US/windows/printer-problems-in-windows-help#fix-printer-problems=windows-xp&v1h=win8tab1&v2h=win7tab1&v3h=winvistatab1&v4h=winxptab4

    I hope this helps.

  • Windows 7 live mail... I can't get anything you wanted my Outbox... This error is typical?

    When I get this typical error in the Outbox, that nothing of the IRA. Inbox is ok, even when I remove the file from the Outbox.

    An unknown error has occurred.

    Subject 'test' 4 '.
    Server error: 554
    Server response: 554 relay unauthorized this IP address
    Server: 'smtp.eastlink.ca '.
    Windows Live Mail error ID: 0x800CCC6F
    Protocol: SMTP
    Port: 25
    Secure (SSL): No.

    This means that your email account settings are configured incorrectly

    http://www.eastlink.ca/customersupport/HighSpeedInternet/email.aspx

  • Tutorial of the postcard - can't get the new text block started

    It is a very basic question. I do the tutorial of postcard. I'm unable to get a second text block began on the front of the postcard to the time of the event. I take the text tool and drag it, but it does not create a new text frame. He thinks I want to type the information in the context of existing text.

    I hit escape repeatedly to try and out the first block of text, clicking on the tool text several times, tried shift and click, put the date in a Microsoft Word's doc information and then tried to 'Place' - all to nothing done. How can I get the file to understand that I am creating a second block of text?  How to get out the original text block?

    This seems to be a problem for me, I can't "uncheck" any tool path - by clicking on another tool or hit escape. It does not work. I close the file, then open it new in order to use a new tool. Very frustrating and time-consuming. I work under Windows, if that helps.

    Thank you.

    Try to zoom a little and start your slide text tool starting off the page on the region of cardboard. Using the black selection tool, you can drag to the page and resize it using the bounding box handles.

  • I can't get a wireless connection.

    This is going to be long so bear with me. I moved to a new location, a few days ago and got Warner from time to set up my internet cable sometime after I moved. It has set up and the modem worked perfectly, I was able to get online.

    After he had left I took my wrt54g router I used in my previous House and hung and it worked only when the cable was attached to my laptop. When I unplugged to use the laptop in the living room or when I tried to connect another laptop wireless I got it wouldn't connect.

    I went to 192.168.1.1 and set everything in place, reset the router, the modem, cycle power, everything. Is not connected, when I have searced for a Wi - Fi connection I've implemented would show up as a secure connection but on the laptop that I used to set up it would not even ask the wpa key and tries to connect for a minute, nothing would happen on the 2nd laptop, it would but after.

    So I called warner of time which says: if I go online there is nothing they can do, then they told me to call the linksys, I did and they told me to reset it I tried like 10 times and told me that the support or something has expired so I either have to buy another router go online and look for a solution, or pay $ 40 a month, or something.

    The only problem for me is that I can't get anything to connect to the wireless connection, I've set up, he shows up and all but nothing to connect.

    I tried the exact same things I did on my laptop on my old pc and everything works... I don't know if laptops work with linksys?

Maybe you are looking for

  • 5 TB external USB 3 with Win XP

    The external drive of 5 to is announced for use with XP (as well as other versions of Windows). I have Windows XP (32 bit). I know this has a maximum of 2 TB. But the player is announced as being usable under XP. It is visible in Device Manager. It i

  • method accewwing from another thread causes some 'bad object type' error with c# VS2008

    I'm snapping a picture to a main Viewer, draw a rectangle around an alignment and extract the part of the image to a different viewer for further processing. I tried everthing and all was good until I started to build a Wizard for the operator throug

  • Cannot activate oem Windows XP after the relocation.

    I bought Windows XP Pro oem in 2007, I had to reinstall several times due to hardware failures, the recent is a hard drive.  During the reinstallation and activation, I get the message that my product key is not valid.  How can I fix this so that I c

  • Back to Vista to Windows 7

    I have this computer that had vista on it.  I've upgraded to Windows 7 and have had problems.  So I was wondering if there is a way to get back to Vista.  I don't have the drive to do so because it was preinstalled on the computer.  You some way simp

  • Language setting of the Canada

    In fact, it is a problem that goes all the way back to Windows 95, but it is still the case in Windows 7. I am Canadian and lived in Canada for more than 30 years; I'm still part of the year. So, naturally, I chose English (Canada) as my language whe