Tom's Guide | Tom's Hardware | Tom's Games
![]() |
![]() |
![]() |
I have absolutly no Javascript coding knowledge but i think what i need to do is relitivly easy...
I have a webpage with a javascript variable that is
var RACE_PROPERTIES =That variable needs to change according to another page on a different server
so is there a way i can set var RACE_PROPERTIES on my page to equal var SETTING on site2.com/testing
i think this is possible with get variable but i dont know javascript so any help will be greatly appriciated.

This is one of those tasks that you believe will be easy until you think carefully about it:
Here's what I mean.
Let's imagine we are on the other server. We have a document in which there is some javacsript and in that javascript is a variable, with a value. The javascript itself is just a bunch of words and letters and punctuation. It's nonsense until it's seen by a browser which can interpret the words and letters and punctuation.
So back on your server, what you need to do is make your javascript program open a new browser, run the page, interrogate the page and return the value that's held in that particular javascript variable. The problem you have is that the value of that javascript variable is not accessible through the document object model (DOM) which is what you would normally use.
If you have control over site2.com/testing then you could get it to write the value of that variable into an object (a div with an id) on the page which you could then easily interrogate. My guess is that you don't have access to site2.com/testing or you wouldn't be trying to do this.
So the answer is, because you need a javascript interpreter to interpret javascript, and because these are built into the machine code of the browser and are not accessible from within the browser, it probably is not possible to do what you are trying to do, in the way you are trying to do it. There are, however, other ways to achieve a similar effect.

Well I have to thank you Uptoeleven you made it very clear for me. Its to bad its difficult to do so but I guess thats life.

![]() |
![]() |
![]() |

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.
| Ads by Google |