another technical blog...technically

Wednesday, July 20, 2016

Embarassing stories: console.log with IE Enterprise mode

I know, you're here and your soul is yelling: "why in the world, even if i'm working on IE11, there is someone who uses Enterprise mode, so i have to work in IE8 emulation mode?"
I don't know why, but this is something which makes me hate this work, even because right now i'm working a lot with AngularJS.
This post explains some simple tricks to make AngularJS and IE8 happy together: AngularJS and IE8 - Happy Together? and helped me a lot.
In my case i had also a custom action which was not working with Enterprise Mode. After banging my head for some hours i noticed that the code worked only when i use developer tools (you know, the wonderful F12 key), otherwise no joys for me.
The problem was simple: IE8 and console.log are not very happy together.
So i had to declare the custom action like you can see below:
1
2
3
4
5
6
7
<?xml version=" encoding="utf-8"><elements xmlns="http://schemas.microsoft.com/sharepoint/">
  <customaction location="ScriptLink" scriptsrc="~sitecollection/Style Library/shared/consoleLogHelper.js">
  <customaction location="ScriptLink" scriptsrc="~sitecollection/Style Library/ca/ca_enabledScript.js">
  <customaction location="ScriptLink" scriptsrc="~sitecollection/Style Library/ca/ca_commandAction.js">
  <customaction ...="" commanduihandlers="">
        <commanduihandler command="CommandName" commandaction="javascript:MyProject.CommandAction('{SiteUrl}','{ListUrlDir}','{ListId}');" enabledscript="javascript:MyProject.IsEnabled();">
...
You can see on top consoleLogHelper.js, this script, if console.log is undefined, instantiate it so the code does not explode.
Share:

Related Posts:

0 commenti:

Post a Comment

Because of a lot of SPAM about courses, I need to moderate all comments here.
I ensure you that I will answer whenever possible (if you are not a spammer).

Me, myself and I

My Photo
I'm just another IT guy sharing his knowledge with all of you out there.
Wanna know more?