is there a way that I can do this? I want to,
call a java function from an HTML page and set a varaible, (function 1)
then switch to a new web page and read the same varaible that was set, (function 2)
I would like to do this in Java if it is possible. I have tried and each time function 2 show the vaaraible
as undefined, eventhrough it is globally defined in an external .js file that is shared by both HTML files.

What I am tring to do is simply pass a variable from one HTML file to another, using Java.

Recommended Answers

All 4 Replies

you can't do that!

You need some help with server side scripting to pass, read, store, and manipulate the data.

If you want it to be done locally (client), Cookies is the way to go. Though, I don't prefer to use it because it is manipulatable by the client unless I don't care for securities. Preferably, server side work is appropriate for most cases.

as said early on you can use a server side language. thus you js function1 will pass the value or the varable to a server side script and value will be stoted and when function2 is called it can look up that varable and use it. or you can use cookies. it works the same way you store than you retrive

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, learning, and sharing knowledge.