Posts Tagged ‘javascript’

Minfied respond.js does not work in unpatched IE7

May 14th, 2013

I haven’t the full reason for the problem – exactly which implicit line ending that goes wrong – or whatever else that is broken.  But the (almost) fix is – don’t use the minified version.  At github you can get either version as (respond.min.js or respond.src.js).  Go for the latter, it is the non-minified one.

In my unlatched IE7 I get a somewhat stocastic behaviour.  When just browsing it first fails but a reload makes the page load properly.
When I debug both the debugger and IE freezes at a regular javascript row in respond.js.  “document = doc.documentElement”.  This is also where I give up.

Other browsers – including Safari/Ipad and built-in/Android seems to work alright with the minified version.

How to write classes in Javascript

Nov 14th, 2012

I am not doing yet a write up on how to write classes in javascript; instead I just link to the one stop shop by Douglas Crockford.  It contains examples and explanations.

By the way – if you are serious about Javascript; do read his book.

Debugging javascript in ie7

May 5th, 2011

This is a dispersed article about caveats I found when forced to debug javascript in IE7.

Out of date web browser.  Out of date script engine.  Limping solution.

To fire up the debugger, enter

debugger;

as javasctipt on a row exceuting before where you want to start debugging.  One could probably divide by zero or something that makes IE throw up a dialogue asking if you want to debug or not.  and then answer yes…

There doesn’t seem to be any good official debugger for IE7, unless you have Visual studio installed.  Search the web and there is a NT4-compatible Microsoft Script Debugger; it is not very good.  There is one or more solutions but this is the only I have tried.

If you get a dialogue/error message

Request format is invalid: application/json; charset=utf-8

when working with jquery and ajax on an iis / dotnet solution, it might be due to missing lines in web.config.  The code below is for Dotnet3.5.  I don’t know what it looks like in 2.0 or 4.0.

<system.web>

<httpHandlers>
<remove path=”*.asmx” verb=”*” />
<add path=”*.asmx” type=”System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35″ validate=”false” verb=”*” />
<add path=”*_AppService.axd” type=”System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35″ validate=”false” verb=”*” />
<add path=”ScriptResource.axd” type=”System.Web.Handlers.ScriptResourceHandler, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35″ validate=”false” verb=”GET,HEAD” />
</httpHandlers>
</system.web>

 

Ajax JSON.stringify IE7 problem

May 4th, 2011

Just a tip up front.  IE7 runs an older script engine than IE8 and has no full support for Json.

So your code that calls JSON.stringify does not work.

The remedy is to include json2.js from https://github.com/douglascrockford/JSON-js/blob/master/json2.js.  It does not interfere with IE8+.  Just download the file (the “raw” button – saveas) to your script lib and include as so:

<script src="Script/json2.js"; type="text/javascript"></script><!-- Needed for IE7. -->

Running IE9 in compatibility mode does not make this error appear – it seems like IE9-in-IE7-mode is running a newer script engine.

That impediment avoided you are free to continue adding value to your site.