locked
Bing.com sample code not running in debugger

    Question

  • Team-

     

    I have a javascript file that I copied verbatim from Listing 1 at

    http://msdn.microsoft.com/en-us/library/cc316942.aspx

    This sample code runs fine in my Internet Explorer.  However, I am trying to run it in the debugger of Visual Studio, and it is not running.  I get the error:

    JavaScript runtime error: 'VEMap' is undefined
    File: ms-wwa://89bb7084-772e-4282-b136-6fc29c084bfe-jp9dqj3fntamg/default.html, line: 12 column: 15 JavaScript runtime error: Unable to get value of the property 'LoadMap': object is null or undefined
    File: ms-wwa://89bb7084-772e-4282-b136-6fc29c084bfe-jp9dqj3fntamg/default.html, line: 13 column: 15

     

    Can someone help?

     

    Thanks!

     

    Tuesday, October 25, 2011 8:03 PM

Answers

All replies

  • Security restrictions do not allow your main html file to load scripts from external sources (the Bing Map API).  The solution is to add an iframe element to your page which refers to another html file that can reference an external script.  You can send messages from your main script to the script that controls the map in the iframe.

    This is demonstrated in the mashup sample or take a look at my example in this thread:

    http://social.msdn.microsoft.com/Forums/en-US/winappswithhtml5/thread/f5a852c1-c757-40f2-bc41-8d6a190a233e

     



    Tuesday, October 25, 2011 8:18 PM
  • Thanks for much, but... your code doesn't generate an error, but I don't get a map either; just a blank white canvas on the right side of the page.
    Tuesday, October 25, 2011 9:05 PM
  • Make sure the default.js and map.js scripst are inside a folder with name js (or modifiy the html that loads them).

    Currently, the html looks for js/default.js and js/map.js

     


    • Edited by jrboddie Tuesday, October 25, 2011 9:26 PM
    Tuesday, October 25, 2011 9:25 PM
  • Thanks!  That worked.
    Wednesday, October 26, 2011 2:07 AM