Tagged pages

Found 29 articles tagged with JavaScript

Non blocking CSS load on the page
Load external CSS files in an async manner
Like JavaScript, CSS files are also loaded on the page by default in a blocking manner. Luckily for us, for JavaScript we can use either async or defer attributes on the script tag itself to change the behavior of JavaScript external file loading... read more
Inline JavaScript and CSS tags with ASP.NET MVC
Rendering inline JavaScript and CSS tags in document in MVC
With ASP.NET MVC Microsoft introduced bundling of JavaScript and CSS resources. These bundles work pretty well but to me it always looks not so natural to define bundles in BundleConfig.css and I had problems if I want to edit CSS or JavaScript during runtime because they are cached... read more
Serialize html form to JSON without using JQuery
Transform user input from HTML form fields to JSON
jQuery makes things a lot easir when working with DOM. So many thing there out of the b and you do not need to worry about browsr compatibility... read more
Copy text value to clipboard using jQuery
Simple sample of using jQuery to copy value to clipboard
I recently needed to copy some value from the web UI to clients clipboard. Since this is not something you often need to use, I googled a little bit and found that this is easy to do with document.execCommand... read more
Resize image on the client side with JQuery
Reducing the upload sie by resizing image on the client side
Image resizing is considered as a server side operation as JavaScript and HTML were not so sophisticated and HTML5 support was not widely adopted for quite some time. even now, some features are not equally supported by all major browsers. Anyhow, HTML5 is here to stay and over time we will get more and more features supported by all browsers. ... read more
Parse date of Facebook OpenGraph API response with JavasScript
Converting datetime string from Facebook API response to JavaScript Date object
Recently I had an issue while working on an update for my Facebook Album Browser plugin with dates returned from Facebook OpenGraph API. The dates are returned in the following form 2011-06-13T23:31:19+0000 and luckily for me, converting this string to an actual Date object in JavaScript worked pretty well for most of the browsers, but some of them like Safari on iPad did not know to convert this string to a Date object and because of that I was getting default JavaScript date 1970-01-01 00:00:00 UTC+00. After some time spent googling and checking regular expressions, I did not find a suitable solution for this. ... read more
Delayed execution in JavaScript
Thread sleep equivalent in JavaScript
Not very often, but from time to time you need to slow down your code. Most of the time the reason for that is that you need to test some long execution, mostly external source call... read more
Working with GoogleMaps in jQuery style
jQuery plugin for GoogleMaps
I've used GoogleMaps on several web projects and it seemed to me that I'm repeating a lot of code used in the previous projects which lead me to write a common Javascript library to help me easily reuse the code by only copying the JavaScript library to a project or referencing it from CDN. I could not think of a better way to build this library than to use jQuery and build a pligin for this. ... read more
Recognize links in text content with jQuery
Find and replace URLs with anchor tags inside the text
Very often when you are dealing with content from 3rd party like tweets from Twitter of Facebook posts and comments you might end up with some URL inside the content. On both Twitter or Facebook or any other social network, links inside text comments are replaces with anchor tags to those URLs. In order to keep the same user experience and make it more useful o your side where you are serving the content from the other party it is recommended that you do the same. ... read more
Enabling CORS only for specific domains in ASP.NET
Enable cross origin resquests only for certain domains in ASP.NET
Cross-origin resource sharing (CORS) means that page from other domain can make request to some resource which is on other domain. For example, if you try to invoke some WEB API method which is running on different domain you will get exception in the script. By default CORS are disabled in ASP.NET bot you can easily enable them just by modifying web.config for IIS7 and newer versions pf IIS. ... read more