none
Script Error-Unable to get value of the property 'focus': object is null or undefined

    Question

  • Hello Everyone,

    I have found a lot of other topics on this particular error pertaining to Visual Studio 2010 Lightswitch, but most of what I have found has been in regards to the beta releases of Lightswitch. First of all, I will describe my operating environment:

    Windows 7 64 bit

    Visual Studio 2010 Professional with SP1

    Lightswitch 2011 x86

    I am trying to develop my first Lightswitch application, so I have never been able to make anything work with it. I created a Visual Basic Lightswitch application with 2 new tables and when I click the Start Debugging green arrow, I get the follwowing message:

    It doesn't matter wether I click Yes or No in response to the above error message, my application will not run. Also, if I click the Install Microsoft Silverlight icon on the window behind the error message, I either get

    because I currently have version 5.1 installed, or if I uninstall 5.1 and install 4, then I still get the script error.

    I have tried completely uninstalling Lightswitch and Silverlight and then reinstalling Lightswitch and allowing the Lightswitch installer to install Silverlight, but I still get the same script error. I even read somewhere that this may have something to do with the fact that I had Mozilla Firefox as my default browser, so I made Internet Explorer 9 my default browser. Also, there are no updates available in Microsoft Update. I have also read somewhere that it is possible for lightswitch to run on 64 bit machines. I do not know what else I can try. Does anyone have any suggestions?

    Thanks,

    David Warwick

    Monday, August 20, 2012 12:32 AM

Answers

  • Wow, I have been working on this all day and I just figured it out. Here it is, after 10PM. I have literally uninstalled and reinstalled VS and Lightswitch multiple times, and I have tried every combination of Silverlight SDK's and runtimes and I have been scowering the forums and Google trying to figure this out, but here is the answer:

    1. Open Internet Explorer (I am using IE9)

    2. Click Tools (Gear Icon)

    3. Click Manage Add-ons

    4. Look under "Show" where it says "Currently Loaded Add-ons" and change it to say "All Add-ons"

    5. Scroll down to "Microsoft Corporation" and find "Microsoft Silverlight" My installed version is 5.1.10411.0

    6. The status should say "Disabled" which is what has been causing the problem!

    7. Click Enable and then try to run your Lightswitch application and it should work.

    Now I have a question/statement for Microsoft. I have uninstalled and reinstalled Silverlight numerous times today and I guarantee you that I never Disabled Silverlight. Why would it be disabled by default? If nothing else, when you are installing Lightswitch, the installer should enable Silverlight! This is very frustrating, but I am glad I figured it out.

    Thanks,

    David

    • Marked as answer by David.Warwick Monday, August 20, 2012 5:35 AM
    Monday, August 20, 2012 5:35 AM

All replies

  • Hi David

    I can't able to find out the error message in your post. Kindly provide us so that we can able to give you a better solution.

    I think you forgot to install Silverlight 4 or 5 SDK, kindly verify it and run it again.

    Regards


    Rashmi Ranjan Panigrahi
    www.lightswitchspecial.com

    If you found this post helpful, please “Vote as Helpful”. If it answered your question, please “Mark as Answer”.
    This will help other users to find their answer quickly.

    Monday, August 20, 2012 3:49 AM
  • The images that you provided are not showing or loading properly. Can you fix them or write out the text that they are displaying?

    Justin Anderson, LightSwitch Development Team

    Monday, August 20, 2012 4:23 AM
    Moderator
  • Thank you for your reply Rashmi. I had inserted a screen capture of the error message, but for some reason I don't see it in my post. I am not sure what happened.

    I have the Silverlight 4 Developer Runtime installed, the Silverlight 4 SDK, and after reading your response, I just installed the Silverlight 5 SDK. If I install the Silverlight 5 Developer Runtime.

    When I press F5 in VS, The error occurs after the Build Succeeds. It says:

    Script Error

    An error has occurred in the script on this page.

    Line 13

    Char 1

    Unable to get value of the property 'focus': Object is null or undefined.

    file:///C:/Users/David/AppData/Local/Microsoft/Silverlight/OutOfBrowser/2189175185.localhost/index.html

    and here is the contents of that file....Line 13 is bolded below:

    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml" >
      <!-- saved from url=(0014)about:internet -->
    <head>
      <meta http-equiv='X-UA-Compatible' content='IE=EmulateIE7'/>
      <title>Microsoft Silverlight</title>
      <style type='text/css'>
        html, body { height: 100%; overflow: auto; }
        body { padding: 0; margin: 0; }
        #silverlightControlHost { height: 100%; }
      </style>
    </head>
    <body scroll="no" onload="document.getElementById('_sl').focus()">
        <div id="silverlightControlHost">
          <object id='_sl' data="data:application/x-silverlight," type="application/x-silverlight" width="100%" height="100%">
              <param name="source" value="offline://2189175185.localhost"/>
              <param name="background" value="White"/>
              <param name="enableGPUAcceleration" value="False"/>
              <a href="http://go.microsoft.com/fwlink/?LinkID=124807" style="text-decoration: none;">
                  <img src="http://go.microsoft.com/fwlink/?LinkId=108181" alt="Get Microsoft Silverlight" style="border-style: none"/>
              </a>
          </object>
          <iframe style='visibility:hidden;height:0;width:0;border:0px'></iframe>
        </div>
    </body>
    </html>

    Any idea what could be causing the error?

    Thanks,

    David

    Well, I guess bolding doesn't work for me...Line 13 above is:

    <body scroll="no" onload="document.getElementById('_sl').focus()">

    Monday, August 20, 2012 4:38 AM
  • Wow, I have been working on this all day and I just figured it out. Here it is, after 10PM. I have literally uninstalled and reinstalled VS and Lightswitch multiple times, and I have tried every combination of Silverlight SDK's and runtimes and I have been scowering the forums and Google trying to figure this out, but here is the answer:

    1. Open Internet Explorer (I am using IE9)

    2. Click Tools (Gear Icon)

    3. Click Manage Add-ons

    4. Look under "Show" where it says "Currently Loaded Add-ons" and change it to say "All Add-ons"

    5. Scroll down to "Microsoft Corporation" and find "Microsoft Silverlight" My installed version is 5.1.10411.0

    6. The status should say "Disabled" which is what has been causing the problem!

    7. Click Enable and then try to run your Lightswitch application and it should work.

    Now I have a question/statement for Microsoft. I have uninstalled and reinstalled Silverlight numerous times today and I guarantee you that I never Disabled Silverlight. Why would it be disabled by default? If nothing else, when you are installing Lightswitch, the installer should enable Silverlight! This is very frustrating, but I am glad I figured it out.

    Thanks,

    David

    • Marked as answer by David.Warwick Monday, August 20, 2012 5:35 AM
    Monday, August 20, 2012 5:35 AM
  • I had the same problem with silver light being disabled in manage add ons followed your instructions and enabled silver light and now my SKYGO DESKTOP PLAYER is working Big thank you was getting fed up
    Saturday, November 23, 2013 1:47 PM
  • Yes, the answer is going to manage add ons and enabling the software! Great help, thanks a lot !! :)

    Thursday, March 13, 2014 12:06 AM