Using local file for Web Audio API in Javascript

I had the same problem and I found this very simple solution. audio_file.onchange = function(){ var files = this.files; var file = URL.createObjectURL(files[0]); audio_player.src = file;; }; <input id=”audio_file” type=”file” accept=”audio/*” /> <audio id=”audio_player” /> You can test here:

jqGrid client-side searching

You should implement search for single field in a little another way: var grid = jQuery(“#Grid2″); var postdata = grid.jqGrid(‘getGridParam’,’postData’); jQuery.extend (postdata, {filters:”, searchField: ‘error_column’, searchOper: ‘eq’, searchString: ‘Test’}); grid.jqGrid(‘setGridParam’, { search: true, postData: postdata }); grid.trigger(“reloadGrid”,[{page:1}]); You can see live example here. UPDATED: You use loadonce: true and datatype: “local” together. The value loadonce: … Read more

Is it possible to check dimensions of image before uploading?

You could check them before submitting form: window.URL = window.URL || window.webkitURL; $(“form”).submit( function( e ) { var form = this; e.preventDefault(); //Stop the submit for now //Replace with your selector to find the file input in your form var fileInput = $(this).find(“input[type=file]”)[0], file = fileInput.files && fileInput.files[0]; if( file ) { var img = … Read more

How to get client date and time in ASP.NET?

I like the idea of either using the browser/system time and time zone or letting them select their time zone. In a past project I used something like this: <script language=”javascript”> function checkClientTimeZone() { // Set the client time zone var dt = new Date(); SetCookieCrumb(“ClientDateTime”, dt.toString()); var tz = -dt.getTimezoneOffset(); SetCookieCrumb(“ClientTimeZone”, tz.toString()); // Expire … Read more