1

I am learning how to use phonegap now. I have a little bit experience in Android.

Since Android is Java-based, if we want to have global variable, we can simply define a static variable to handle it. So, we will be able to reference the static variable across all the activities in the app.

But phonegap is javascript-based, how am I going to create global variable that is able to be used across all the html pages?

1 Answer 1

2

Javascript offers Local Storage.

Take a look at this answer: Phone gap implementation of 'application settings'

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

2 Comments

Is there any other way? Writing a whole global object into local storage seems strange.
localStorage is definitely the way to go. That's what it's made for.

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.