<?xml version="1.0" encoding="utf-8"?>
<rss xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title>Jonathan's Blog - Latest Comments</title><link xmlns="http://www.w3.org/2005/Atom" rel="http://api.friendfeed.com/2008/03#sup" href="http://disqus.com/sup/all.sup#forumcomments-5d6c9c39" type="application/json"/><link>http://garetjax-blog.disqus.com/</link><description>Personal weblog of Jonathan Stoppani</description><atom:link href="http://garetjax-blog.disqus.com/comments.rss" rel="self"></atom:link><language>en</language><lastBuildDate>Tue, 17 Jan 2012 09:10:27 -0000</lastBuildDate><item><title>Re: Using a magnetic card reader with jQuery</title><link>http://garetjax.info/articles/2010/01/magnetic-card-jquery/#comment-413371273</link><description>@nilesh u talking about my comment or overall page?</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Jazzy</dc:creator><pubDate>Tue, 17 Jan 2012 09:10:27 -0000</pubDate></item><item><title>Re: Using a magnetic card reader with jQuery</title><link>http://garetjax.info/articles/2010/01/magnetic-card-jquery/#comment-413350236</link><description>Works flawless.....</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Nilesh</dc:creator><pubDate>Tue, 17 Jan 2012 08:29:43 -0000</pubDate></item><item><title>Re: Using a magnetic card reader with jQuery</title><link>http://garetjax.info/articles/2010/01/magnetic-card-jquery/#comment-407180592</link><description>Any cheap card reader you guys can recommend for this kind of project? I found one on ebay, not sure will it work with this :&lt;br&gt;&lt;br&gt;&lt;a href="http://www.ebay.com/itm/Honeywell-IDRA-335133B-DL-DELL-ONLY-MSR-USB-HID-3TRK-magnetic-strip-card-reader-/230687770687?pt=LH_DefaultDomain_0&amp;amp;hash=item35b610083f#shId" rel="nofollow"&gt;http://www.ebay.com/itm/Honeyw...&lt;/a&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Jazzy</dc:creator><pubDate>Tue, 10 Jan 2012 11:08:16 -0000</pubDate></item><item><title>Re: Using a magnetic card reader with jQuery</title><link>http://garetjax.info/articles/2010/01/magnetic-card-jquery/#comment-376000758</link><description>I didnt need to do all that fancyness with the timing of when keys were pressed. I just had to record the card reader and then submit the form once done. I stuffed the cc data into a hidden field.. heres my code (I'm using &lt;a href="http://asp.net" rel="nofollow"&gt;asp.net&lt;/a&gt; and also jquery):&lt;br&gt;&lt;br&gt;    &amp;lt;script type="text/javascript"&amp;gt;        //this attaches the keyup event to the html element to capture all keypress' and puts them in the hidden field        $(function () {            var btnSubmit = document.getElementById('&amp;lt;%= btnSubmit.ClientID %&amp;gt;');            btnSubmit.focus();            $('html').keypress(function (e) {                var keyPressed = e.which;                var hiddenField = document.getElementById('&amp;lt;%= creditCardDetailText.ClientID %&amp;gt;');                if (keyPressed != 13) {                    hiddenField.value += String.fromCharCode(keyPressed);                }             });        });    &amp;lt;/script&amp;gt;&lt;br&gt;&lt;br&gt;the (keypressed != 13) makes sure I dont capture the enter key after its done reading.&lt;br&gt;&lt;br&gt;I got the idea to do it like this after looking through your code.. Thanks!</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Evan Larsen</dc:creator><pubDate>Wed, 30 Nov 2011 11:34:02 -0000</pubDate></item><item><title>Re: Using a magnetic card reader with jQuery</title><link>http://garetjax.info/articles/2010/01/magnetic-card-jquery/#comment-374340291</link><description>Rick, let us know if you find a IE work around. &lt;br&gt;&lt;br&gt;On a side note if your using an RFID reader and all it posts is the number and then enter, so no track or end senitel is the start and end bits still required?</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">John</dc:creator><pubDate>Mon, 28 Nov 2011 13:38:07 -0000</pubDate></item><item><title>Re: Using a magnetic card reader with jQuery</title><link>http://garetjax.info/articles/2010/01/magnetic-card-jquery/#comment-361314117</link><description>Update: I still am having issues, but at least I am moving a little closer to getting this to work in all browsers.  For anyone else having issues, If you change the jQuery read.observe object to document, instead of window, IE will at least read in all the characters.  I am having an issue however with the call back.  After the last information is read, it is not firing the callback function reader.cardRead in IE 8, and IE9 in compatibility mode.  Any infomation you can provide would be greatly appreciated.</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Rick</dc:creator><pubDate>Fri, 11 Nov 2011 15:36:11 -0000</pubDate></item><item><title>Re: Using a magnetic card reader with jQuery</title><link>http://garetjax.info/articles/2010/01/magnetic-card-jquery/#comment-353424616</link><description>Correction...  The code does work in IE9 as long as compatibility mode is off.  Does not work at all in IE8.  Any help is appreciated.</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Rick</dc:creator><pubDate>Wed, 02 Nov 2011 02:41:34 -0000</pubDate></item><item><title>Re: Using a magnetic card reader with jQuery</title><link>http://garetjax.info/articles/2010/01/magnetic-card-jquery/#comment-353424211</link><description>Anyone having any issues with IE?  I have this working great on all browsers (Chrome, Firefox, Safari, and Opera) , but sadly, it does not work in IE8 or IE9.  I also need this to work in compatibility mode.  When switched into compatibility mode, the javascript errors out at not understanding what CardReader even is.  It does not see it as an object class.  Any help would be appreciated.</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Rick</dc:creator><pubDate>Wed, 02 Nov 2011 02:39:28 -0000</pubDate></item><item><title>Re: Using a magnetic card reader with jQuery</title><link>http://garetjax.info/articles/2010/01/magnetic-card-jquery/#comment-280297105</link><description>I am trying to get this to work with jquery 1.6.2.. My card reader works fine on your timing test page as well as in notepad or in anything else for that matter.. I got your script set up and a form field to set the value to.. i know your script is set up as when i swipe on any normal page it tries to find the data read from the card using the ctrl+f search box.. but on my page i set up nothing happens when i swipe.. any ideas? incompatible with 1.6.2?</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Danieliser</dc:creator><pubDate>Mon, 08 Aug 2011 03:50:59 -0000</pubDate></item><item><title>Re: Using a magnetic card reader with jQuery</title><link>http://garetjax.info/articles/2010/01/magnetic-card-jquery/#comment-212259920</link><description>If your Card Reader is seen as an HID, then yes. Note that it may need some adaptation, but the working principle will stay the same.</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Jonathan Stoppani</dc:creator><pubDate>Thu, 26 May 2011 12:26:06 -0000</pubDate></item><item><title>Re: Using a magnetic card reader with jQuery</title><link>http://garetjax.info/articles/2010/01/magnetic-card-jquery/#comment-212257548</link><description>Does this jquery and cardreader work with any magnetic swipe card reader and thereby eliminates the need for the use of the dll that comes with it?&lt;br&gt;&lt;br&gt;If this is the case than it will save me quite a bit on the web app I am working on.</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">myfundi</dc:creator><pubDate>Thu, 26 May 2011 12:21:17 -0000</pubDate></item><item><title>Re: Using a magnetic card reader with jQuery</title><link>http://garetjax.info/articles/2010/01/magnetic-card-jquery/#comment-194106820</link><description>Joe, actually no, I don't see any problems other than the "immaturity" of the code. It is a good base to build upon but still has some bugs and limitations as exposed in the comments above. Other than that it should work greatly... ;-)</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Jonathan Stoppani</dc:creator><pubDate>Fri, 29 Apr 2011 10:05:15 -0000</pubDate></item><item><title>Re: Using a magnetic card reader with jQuery</title><link>http://garetjax.info/articles/2010/01/magnetic-card-jquery/#comment-194105949</link><description>Thanks for this article.  I am doing some feasibility research on building a Point of Sale system through a web browser.   Do you see any reason why I couldn't use this jquery example to capture credit cards info swiped through an MSR?</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Joe</dc:creator><pubDate>Fri, 29 Apr 2011 10:03:00 -0000</pubDate></item><item><title>Re: Using a magnetic card reader with jQuery</title><link>http://garetjax.info/articles/2010/01/magnetic-card-jquery/#comment-167654675</link><description>Kevin,&lt;br&gt;&lt;br&gt;Your card reader must support "HID" ("Human Interface Device"), which is a standard whereas a card reader (or barcode scanner, etc) behaves just like a standard computer keyboard (i.e., in a sense it "emulates" a keyboard presses).&lt;br&gt;&lt;br&gt;Hope that helps.&lt;br&gt;&lt;br&gt;- jose</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Jose</dc:creator><pubDate>Fri, 18 Mar 2011 11:22:29 -0000</pubDate></item><item><title>Re: Using a magnetic card reader with jQuery</title><link>http://garetjax.info/articles/2010/01/magnetic-card-jquery/#comment-120838652</link><description>Where did you get the value for the error track ID?  I can not find any documentation that shows an error track ID of é (Hex E9) .  The PDF referenced on this page does not show that.   It states that an error will be: 'TrackID' + 'E' + 'ES' + 'ENTER' but does not state that the TrackID is anything different from the three main TrackIDs.  &lt;br&gt;&lt;br&gt;I'm still trying to figure out my problem, but I can say that if I capture a value in the cardError callback, it is the track data.  So, the data is getting read, but it seems that an isError is getting set incorrectly.</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Scott</dc:creator><pubDate>Wed, 29 Dec 2010 15:42:38 -0000</pubDate></item><item><title>Re: Using a magnetic card reader with jQuery</title><link>http://garetjax.info/articles/2010/01/magnetic-card-jquery/#comment-111869781</link><description>has anyone got this to work? my card reader when i swipe a card nothing happens on the screen.</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Kevin</dc:creator><pubDate>Tue, 14 Dec 2010 20:02:44 -0000</pubDate></item><item><title>Re: Using a magnetic card reader with jQuery</title><link>http://garetjax.info/articles/2010/01/magnetic-card-jquery/#comment-65448717</link><description>Here you go: &lt;a href="http://gist.github.com/502257" rel="nofollow"&gt;http://gist.github.com/502257&lt;/a&gt;&lt;br&gt;As you can see the body contains a form with an invisible field, the script will show you an alert box if a read error occurs or submit the page with the results (the card content can then be read from the URL). Also turn on the console output in your web browser to receive debugging messages from the class itself. ;-)</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Jonathan Stoppani</dc:creator><pubDate>Sat, 31 Jul 2010 10:56:03 -0000</pubDate></item><item><title>Re: Using a magnetic card reader with jQuery</title><link>http://garetjax.info/articles/2010/01/magnetic-card-jquery/#comment-65445699</link><description>Thanks for the reply Jonathan.&lt;br&gt;"The HTML above is not enough, you should already have a complete working page and the snippet is the scripting part to add to capture the reader input."&lt;br&gt;Could you elaborate? Would it be enough to make a &amp;lt;div&amp;gt;&amp;lt;/div&amp;gt; and call the function within? Some minimalistic test page code would be appreciated (I'm new to jQuery....)&lt;br&gt;Btw, the key-delay test page was just amazing.</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Ursula</dc:creator><pubDate>Sat, 31 Jul 2010 10:35:55 -0000</pubDate></item><item><title>Re: Using a magnetic card reader with jQuery</title><link>http://garetjax.info/articles/2010/01/magnetic-card-jquery/#comment-65433002</link><description>Thank you for the reply. I achieved it by checking whether any input element is in focus and inserted the start sentinel value to that element through the timeout event.&lt;br&gt;&lt;br&gt;// extend the jquery to have a custom selector.&lt;br&gt;// this is used to check if an element has its focus.&lt;br&gt;// usage: $("input:focus").doStuff();&lt;br&gt;&lt;br&gt;jQuery.extend(jQuery.expr[':'], {&lt;br&gt;    focus: "a == document.activeElement"&lt;br&gt;});&lt;br&gt;&lt;br&gt;&lt;br&gt;And modified the first timeout event to be like this:&lt;br&gt;&lt;br&gt;this.timer = setTimeout(function () {&lt;br&gt;    ob.started = false;&lt;br&gt;    ob.finished = false;&lt;br&gt;    ob.isError = false;&lt;br&gt;    ob.input = "";&lt;br&gt;    $("input:focus").val($("input:focus").val() + String.fromCharCode(ob.track_start));&lt;br&gt;}, this.timeout);&lt;br&gt;&lt;br&gt;&lt;br&gt;This solved the problem if someone tried to enter % in any of the input elements in the page.</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Nirmal</dc:creator><pubDate>Sat, 31 Jul 2010 07:40:06 -0000</pubDate></item><item><title>Re: Using a magnetic card reader with jQuery</title><link>http://garetjax.info/articles/2010/01/magnetic-card-jquery/#comment-65425377</link><description>You can add the CardReader listener to the body of the page and add a KeyListener on the input which stops the event propagation. This way if the user wants to use the card reader the input shall not be selected.&lt;br&gt;&lt;br&gt;The more elegant solution would be to implement point 3 of he TODOs and refire the event if the operation times-out</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Jonathan Stoppani</dc:creator><pubDate>Sat, 31 Jul 2010 05:33:48 -0000</pubDate></item><item><title>Re: Using a magnetic card reader with jQuery</title><link>http://garetjax.info/articles/2010/01/magnetic-card-jquery/#comment-65393885</link><description>I am having a situation which this code makes difficult. Our login page accepts either username+password or a card swipe. Whenever I try to key in the % symbol (start sentinel) in the username or password box, it won't show up. Instead the observer is activated and it's preventing the % entry. This will be a problem because special characters are usually allowed in passwords.&lt;br&gt;&lt;br&gt;Is there any way to workaround this problem? Thank you for your time.</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Nirmal</dc:creator><pubDate>Fri, 30 Jul 2010 23:28:06 -0000</pubDate></item><item><title>Re: Using a magnetic card reader with jQuery</title><link>http://garetjax.info/articles/2010/01/magnetic-card-jquery/#comment-65393205</link><description>My fault, I didn't notice the constructor.&lt;br&gt;Thanks for the update.</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Nirmal</dc:creator><pubDate>Fri, 30 Jul 2010 23:20:07 -0000</pubDate></item><item><title>Re: Using a magnetic card reader with jQuery</title><link>http://garetjax.info/articles/2010/01/magnetic-card-jquery/#comment-65356408</link><description>Hi Ursula,&lt;br&gt;The HTML above is not enough, you should already have a complete working page and the snippet is the scripting part to add to capture the reader input. Also remember that it works only if the window has focus!&lt;br&gt;You can test your reader at some extent using the linked test page: &lt;a href="http://static.garetjax.info/magnetic-card-jquery/key-delay.html" rel="nofollow"&gt;http://static.garetjax.info/ma...&lt;/a&gt;&lt;br&gt;&lt;br&gt;As for the question about the end sentinel, there are no code lines to modify, it suffices to pass the track_end  argument to the CardReader constructor (I think a value of "\r" should do the trick).&lt;br&gt;&lt;br&gt;Hope it helps ;-)</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Jonathan Stoppani</dc:creator><pubDate>Fri, 30 Jul 2010 17:36:33 -0000</pubDate></item><item><title>Re: Using a magnetic card reader with jQuery</title><link>http://garetjax.info/articles/2010/01/magnetic-card-jquery/#comment-65340357</link><description>Nice code, can't get it working though.&lt;br&gt;Is the HTML (i suppose?) above enough? Shouldnt there be any HTML elements to test it (like body?)&lt;br&gt;Also, how do I replace the track end "_" with an ENTER key (Asc 13) ?&lt;br&gt;As it is now, i have a scanner emulated as a normal keyboard, scanning text or numbers - nothing happends on the .html though, not even when typing with manual keyboard... ideas?</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Ursula</dc:creator><pubDate>Fri, 30 Jul 2010 15:50:07 -0000</pubDate></item><item><title>Re: Using a magnetic card reader with jQuery</title><link>http://garetjax.info/articles/2010/01/magnetic-card-jquery/#comment-65251762</link><description>Thanks for the feedback!&lt;br&gt;I should really expand a little the script and wrap it in a jQuery plugin, maybe with a little more documentation too...</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Jonathan Stoppani</dc:creator><pubDate>Fri, 30 Jul 2010 06:28:26 -0000</pubDate></item></channel></rss>
