Categoryjquery

jQuery related posts.

Using XDomainRequest object with jQuery

This primairly to work with IE9 and below. IE10+ will just use the jQuery.Ajax method.

Server side I used PHP and generated my $_POST variables based on the $HTTP_RAW_POST_DATA sent.

Recent project – DMagazine.com

Months in the making, but finally live. The all new dmagazine.com website. Below is a link to a more detailed description of the new site.

[button url=”http://www.dmagazine.com/web-exclusive/2013/introducing-the-new-dmagazine-online” style=”blue” size=”small” type=”square” icon=”” target=”_blank”] Introducing the new dmagazine.com [/button]

Dynamic Link Tag Injection

Using jquery to inject a style sheet seems to break IE7/8. The scenario was when a user passed in a custom param via the URL the code would inject that particular css. Ideally I should have gone with the native javascript way to create the element since it’s still clean and simple. This may not be an issue, but for my particular scenario it was the case.

jQuery version:


$('head').append($('<link rel="stylesheet" type="text/css" />')
         .attr('href', 'http://www.somedomain.com/css/cool.css'));

Native version:


var link = document.createElement('link');
    link.href = 'http://www.somedomain.com/css/cool.css';
    link.rel = 'stylesheet';
    link.type = 'text/css';
    document.getElementsByTagName('head')[0].appendChild(link);

© 2017 Aldo Lugo

Theme by Anders NorenUp ↑