Adding a JavaScript Function and Using the Geolocation API
Learn how to configure the Geolocation API.
We'll cover the following
Adding a JavaScript function
We now need to add a class to contain our current latitude and longitude. We will do this by following these steps:
- Right-click the
wwwroot
folder and select the “Add, New Folder” option from the menu. - Name the new folder
scripts
. - Right-click the
scripts
folder and select the “Add, New Item” option from the menu. - Enter “javascript” in the Search box.
- Select “JavaScript File.”
- Name the file
bweInterop.js
. - Click the “Add” button.
Tip: In this course, we will be using the
bweInterop
namespace for our JavaScript code to both structure our code and minimize the risk of naming conflicts. - Enter the following JavaScript:
Get hands-on with 1400+ tech skills courses.