0

I am using google maps api on my MVC3 website everything works perfect on Firefox but in Internet explorer I get a error message saying Microsoft JScript runtime error: 'console' is undefined . I have tried to fix this the code that is highlighted is console.log("changed: " + $(object).attr('id')); the portion of that code is

  $(document).bind("location_changed", function (event, object) {
    console.log("changed: " + $(object).attr('id'));

});

the Console is only causing problems with Internet Explorer . How can i fix that.. and i got the code from http://www.wimagguc.com/projects/jquery-latitude-longitude-picker-gmaps/

1

1 Answer 1

1

IE8 and lower does not have a console. Some browsers do not have a console, so when using the console in javascript, it's a best practice to see if it exists first:

$(document).bind("location_changed", function (event, object) {
    if (window.console) {
        console.log("changed: " + $(object).attr('id'));
    }
});

You can see this answer for how to turn console.log into alerts when console is not defined.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.