Tag: jQuery
-
Dragging a File from File Explorer Causes Google Chrome to Crash
Hey everyone, A team member found an interesting bug today that caused chrome to go non-responsive. The cause was simply dragging a file from the file explorer onto a drag and drop upload area. It is reproducible on every site I’ve tested, including Gmail and Dropbox. Reproduce Go to https://mail.google.com Click compose Click attach files…
-
Refresh a Page with JavaScript
Hey everyone, Just a quick post on how to force a page refresh with JavaScript (no jQuery required): location.reload(); Note that the reload function accepts a boolean parameter that can be used for force a server refresh. Alternatively, it just defaults to the cache. Checkout this Stackoverflow post for more info: http://stackoverflow.com/a/5404869/522859
-
Detecting FileSize – jQuery
Hey everyone, Just a quick post on how to detect a file’s size with jQuery. I’m currently using a version of this for basic client side validation: Upload image: $(document).ready(function(){ $(‘#image-file’).bind(‘change’, function() { var fileSize = this.files && this.files.length > 0 && this.files[0].size ? this.files[0].size / 1024 / 1024 : 0; if(fileSize > 0){ $(‘body’).append(”…
-
Twitter Bootstrap – Carousel Only CSS
Hey everyone, I ran into a bit of an issue today with my stylesheet conflicting with Bootstrap. After a bit of tinkering I realised that all I really needed from bootstrap were the Carousel styles. I’ve taken everything else out and included everything that’s left below: .carousel { position: relative; } .carousel-inner { position: relative;…
-
How to Get a JavaScript Stack Trace – Chrome Console
Hey everyone, Just a quick post on something useful I came across today. In JavaScript you can access the stack trace via console using the following command (ctrl + shift + j): console.trace() In Chrome, this will let you navigate to each relevant call by clicking the line number in the console window. I’ve found…
-
JSON Issue: This request has been blocked because sensitive information – MVC
Hey everyone, Started redoing Learner Lessons in MVC4 and AngularJS today. I ran into this little issue while trying to retrieve JSON: This request has been blocked because sensitive information could be disclosed to third party web sites when this is used in a GET request. To allow GET requests, set JsonRequestBehavior to AllowGet It…
-
Australian Tax File Number Generator (TFN)
Updated Tool Available There’s now an easier to access version of this tool available at the following link: Australian Tax File Number (TFN) Generator Along with a few other widgets that have been added more recently: Australian Tax File Number (TFN) Validator Australian Company Number (ACN) Generator Australian Company Number (ACN) Validator New Zealand IRD…
-
How to Customise ShareThis Settings – ShareThis
Hey everyone, I’ve just added ShareThis to a website I’m currently working on. It’s basically a generator for all your typical social network plugins (Facebook Like, Twitter Share, Google+ etc). The main advantage I’ve found with using it is the detailed analytics. While I haven’t had any major issues, there were a few customisations I…
-
Missing Partial (JSON Response) – Ruby on Rails
Hey everyone, I’ve just added pagination (Kaminari) to make an infinite scroll list a little easier to use. Unfortunately, I ran into the following error – had me stumped for a while: Missing partial /contents/content_list_item with {:locale=>[:en], :formats=>[:json], :handlers=>[:erb, :builder, :coffee]}. Searched in: * “/home/chris/funny/app/views” * “/home/chris/.rvm/gems/ruby-1.9.3-p327/gems/kaminari-0.14.1/app/views” The solution was fairly simple, but adding a…