I have a navigation app. In the page Control corresponding js files are present. I want to access an external js file which is in the project js folder. I have specified in
commonFunctions.js
WinJS.Namespace.define(
'commonFunctions', {
authenticate: authenticate
});
Now when accessing the method in the PageControl’s js (page2.js) file
commonFunctions.authenticate();
it gives an error:
0x800a1391 – JavaScript runtime error: ‘commonFunctions’ is undefined
If there is a handler for this exception, the program may be safely continued.
Is this the right way to do this? Or am I missing something?
I believe the issue you’re having is either that you have not referenced your script file inside the page you are loading or you have not wrapped your
commonFunctionsobject in a function.I tried this:
script.js
default.js
default.html