Archive for February, 2014


With “Apps” being the buzz word in SharePoint 2013, and if you could have started developing apps, you could have noticed that your App.js file starts with a statement as below:

“use strict”;

App.js enables you to access SharePoint objects using ECMAScript & the version being used is ECMAScript 5. ECMAScript 5’s strict mode is a way to opt in to a restricted variant of JavaScript. Strict mode is a way to introduce better error-checking into your code.

Strict mode makes several changes to normal JavaScript semantics.

  1. Strict mode eliminates some JavaScript silent errors by changing them to throw errors.
  2. Strict mode fixes mistakes that make it difficult for JavaScript engines to perform optimizations: strict mode code can sometimes be made to run faster than identical code that’s not strict mode.
  3. Strict mode prohibits some syntax likely to be defined in future versions of ECMAScript.

 

Below are the most important restrictions when you use strict mode,

  1. Using a variable without declaring it
  2. Writing to a read-only property
  3. Adding a property to an object whose extensible attribute is set to false
  4. Deleting a variable, a function, or an argument
  5. Deleting a property whose configurable attribute is set to false
  6. Defining a property more than once in an object literal
  7. Using a parameter name more than once in a function
  8. Using a future reserved keyword as a variable or function name
  9. Assigning an octal value to a numeric literal, or attempting to use an escape on an octal value
  10. The value of this is not converted to the global object when it is null or undefined
  11. The string “eval” cannot be used as an identifier (variable or function name, parameter name, and so on)
  12. You cannot declare a function inside a statement or a block
  13. If a variable is declared inside an eval function, it cannot be used outside that function
  14. The string “arguments” cannot be used as an identifier (variable or function name, parameter name, and so on)
  15. You cannot change the values of members of the local arguments object
  16. “with” statements not allowed

Note : Browsers not supporting strict mode will run strict mode code with different behavior from browsers that do, so don’t rely on strict mode without feature-testing for support for the relevant aspects of strict mode. Strict mode code and non-strict mode code can coexist, so scripts can opt into strict mode incrementally.

Advertisements

SharePoint 2007 (MOSS) & SharePoint 2010 have an option of “Sign in as different user” in the menu at the right top corner of the page. Developers used this handy menu to test their customizations for different users by logging in with another account. But in SharePoint 2013, you will not be finding that  option. You just can sign-out from the site, re-open the browser & login again.

Not sure is it removed with a reason. But MS references say it is a problem with SharePoint 2013.

So, How do I login as different user to my SharePoint site? There are two ways you can do it:

1) IE’s “Run as different user” option

This is the way old method we used to start any application with a different credentials. That is by using the Run as different user option that will be visible if you hold the Shift key when you right-click a program icon.

Start Internet Explorer by using the Run as different user option, where you can provide the different credentials and then go to the SharePoint site.

2) Navigating to the close connection page

More simple way is to browse the close connection page. Hit the below URL in your browser where you have opened your site.

http://siteurl/_layouts/closeConnection.aspx?loginasanotheruser=true

You will be getting a pop up to enter the new credentials where you can sign in as different user.

Note : This option uses an unsupported browser feature which is unreliable and may causes other issues. Currently this option does not work in IE 10 and Safari.

 

Hope it helps.