Monday, August 29, 2016

Forcing IE10 to render IE9 due to Telerik incompatibilities

We use a lot of Telerik RadGrids and such to run AJAX for smoother UX on form submits. However one of our clients reported a strange issue when using IE10. Absolutely nothing would happen on clicking Submit. It worked on any version other than IE10, even IE9.

After much hair-pulling and googling, it turns out that the 2010 version of Telerik was released before IE10 existed. With newer versions of Telerik it is of course IE10 compatible, but for older Telerik versions some things don't work.

I didn't want to go through the hassle of upgrading Telerik and risk breaking any assemblies, so I needed a quick hacky workaround. What I ended up finding was that you could "fix" this issue by forcing IE10 to load using IE9 Document Mode.

I loaded both a meta tag and a header to tell IE10 to emulate IE9. So far it works, altho it's not the best long-term solution.


// force IE10 to load like IE9
var isIe10 = Request.UserAgent.ToString().IndexOf("MSIE 10.0") > -1;

if (isIe10)
{
    // add meta
    HtmlMeta meta = new HtmlMeta();
    meta.HttpEquiv = "X-UA-Compatible";
    meta.Content = "IE=EmulateIE9";

    // add header
    Response.AddHeader("X-UA-Compatible", "IE=EmulateIE9");
}
    else
{
}

Sunday, August 21, 2016

Oft-used Velocity.js methods

Scroll to an element
$element.velocity("scroll", { duration: 600, easing: "easeInSine"});

Stop existing velocity animations before running (de-queue)
$element.velocity("stop").velocity(...);

Adjust height
$element.velocity({ height: '400px' });

Adjust transform
$element.velocity({ translateY: '-100%' });

Fade in element
$element.velocity({ opacity: 1 }, { display: "block" });

Fade in element w/ a delay
$element.velocity({ opacity: 1 }, { display: "block", delay: 400 });

Fade out element
$element.velocity({ opacity: 0 }, { display: "none" });

Tuesday, August 16, 2016

Notes on Node.js using Express.js

To install Express for the first time:
npm install -g express-generator

Install Express files in a directory
express [PROJECTNAME]

Then install package.json after checking it has what you want
npm install

To start Node.js using Express on Windows cmd:
set DEBUG=[SERVERNAMEHERE]:* & node index.js