Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Page 1 of 2 12 LastLast
Results 1 to 15 of 18
  1. #1
    New Coder
    Join Date
    Sep 2010
    Location
    High Wycombe, UK
    Posts
    26
    Thanks
    4
    Thanked 0 Times in 0 Posts

    Post javascript trans-file variable changing

    as mentioned b4 i am designing a game. I'm finding the questions ppl post here and the subsequent answers, very helpful. Eventually this will go on a server but I would like to do some tests on my laptop.

    Can i have a file open on my laptop called, say c:\desktop\game\player1.html obviously running my javascript game and another on the same laptop called c:\desktop\game\player2.html and then an event triggered by the user (me!) utilising a method (of object newPlayer.player1) in the player1.html file, change the value of a property of an object (newPlayer.player2) in player2.html??? Purely with Javascript???

    just to amuse myself with a bit of pre-alpha testing????

    Thanks,
    Morlaf (the eternal newbie!)
    Morlaf - Learning JavaScript!

  • #2
    Supreme Master coder! Philip M's Avatar
    Join Date
    Jun 2002
    Location
    London, England
    Posts
    17,730
    Thanks
    202
    Thanked 2,508 Times in 2,486 Posts
    In a word, no.

    It is your responsibility to die() if necessary….. - PHP Manual

    All the code given in this post has been tested and is intended to address the question asked.
    Unless stated otherwise it is not just a demonstration.

  • #3
    Senior Coder rnd me's Avatar
    Join Date
    Jun 2007
    Location
    Urbana
    Posts
    4,184
    Thanks
    10
    Thanked 569 Times in 550 Posts
    you can run a simple http server on your laptop and then it would be pretty simple using just javascript.
    my site (updated 13/9/26)
    BROWSER STATS [% share] (2014/1/19) IE7:0.2, IE8:6.7, IE11:7.4, IE9:3.8, IE10:4.4, FF:18.3, CH:43.6, SF:7.8, MOBILE:27.5

  • Users who have thanked rnd me for this post:

    Morlaf (04-19-2013)

  • #4
    New Coder
    Join Date
    Sep 2010
    Location
    High Wycombe, UK
    Posts
    26
    Thanks
    4
    Thanked 0 Times in 0 Posts
    Quote Originally Posted by rnd me View Post
    you can run a simple http server on your laptop and then it would be pretty simple using just javascript.
    Aha!
    that, my furry friend, is exactly how I like my coffee!
    so..... how do i do that?
    do i have to install and run php first?

    please elaborate further!

    Thanks,
    Morlaf
    Morlaf - Learning JavaScript!

  • #5
    Senior Coder rnd me's Avatar
    Join Date
    Jun 2007
    Location
    Urbana
    Posts
    4,184
    Thanks
    10
    Thanked 569 Times in 550 Posts
    Quote Originally Posted by Morlaf View Post
    Aha!
    that, my furry friend, is exactly how I like my coffee!
    so..... how do i do that?
    do i have to install and run php first?

    please elaborate further!

    Thanks,
    Morlaf
    i used to use POW, a firefox extension that no longer works.
    it's VERY simple to setup and get running in a few minutes.

    i see there is a replacement for it: https://addons.mozilla.org/en-US/fir...erver/?src=api

    i have not tried that, but it looks like POW, which was great.



    if you have a pro version of window, you can go to
    control panel>
    add remove programs (aka programs and features)>
    windows features>
    Internet Information Services>
    enable web server, wold-wide-web services, or http server, depending on version of windows.


    the next simplest common solution is probably apache. it might take a bit more effort to setup, but it's not as hard as it used to be, and you can get it working in an hour or two.

    i've heard good things about https://code.google.com/p/mongoose/, but havn't used it.

    really, any of these solutions are enough to do what you want.

    you don't need php or mysql, just the ability to browse HTML files in the browser from an HTTP url.

    once you have it setup, you can use cookies or localStorage to talk between windows/tabs originating the same site.
    localStorage provides an event "storage" that fires everytime a value is saved on another tab.
    by subscribing to the storage event, you can see which key changed, load that key, and do whatever you want with the saved data.
    Last edited by rnd me; 04-19-2013 at 07:38 PM.
    my site (updated 13/9/26)
    BROWSER STATS [% share] (2014/1/19) IE7:0.2, IE8:6.7, IE11:7.4, IE9:3.8, IE10:4.4, FF:18.3, CH:43.6, SF:7.8, MOBILE:27.5

  • #6
    New Coder
    Join Date
    Sep 2010
    Location
    High Wycombe, UK
    Posts
    26
    Thanks
    4
    Thanked 0 Times in 0 Posts
    Quote Originally Posted by rnd me View Post
    ...if you have a pro version of window...
    how about is i have Windows 7 Home Premium?

    my work's laptop is running some version of Windows Pro.

    but I'd rather not use that.....
    thanks Youo've given me something to work with!
    :O)

    Morlaf
    Morlaf - Learning JavaScript!

  • #7
    Senior Coder rnd me's Avatar
    Join Date
    Jun 2007
    Location
    Urbana
    Posts
    4,184
    Thanks
    10
    Thanked 569 Times in 550 Posts
    Quote Originally Posted by Morlaf View Post
    how about is i have Windows 7 Home Premium?

    my work's laptop is running some version of Windows Pro.

    but I'd rather not use that.....
    thanks Youo've given me something to work with!
    :O)

    Morlaf
    IIS does not come with Home, but you can enable it on your laptop (which DOES have IIS) and still work on your desktop, assuming they are networked...
    my site (updated 13/9/26)
    BROWSER STATS [% share] (2014/1/19) IE7:0.2, IE8:6.7, IE11:7.4, IE9:3.8, IE10:4.4, FF:18.3, CH:43.6, SF:7.8, MOBILE:27.5

  • #8
    New Coder
    Join Date
    Sep 2010
    Location
    High Wycombe, UK
    Posts
    26
    Thanks
    4
    Thanked 0 Times in 0 Posts
    so i will need more than one terminals? will my one and only laptop not suffice? to act as server and client(s)?
    Morlaf - Learning JavaScript!

  • #9
    Senior Coder rnd me's Avatar
    Join Date
    Jun 2007
    Location
    Urbana
    Posts
    4,184
    Thanks
    10
    Thanked 569 Times in 550 Posts
    Quote Originally Posted by Morlaf View Post
    so i will need more than one terminals? will my one and only laptop not suffice? to act as server and client(s)?
    you can do both on the laptop; server don't use much CPU power.
    i simply thought you mentioned that you would rather work on the desktop...
    my site (updated 13/9/26)
    BROWSER STATS [% share] (2014/1/19) IE7:0.2, IE8:6.7, IE11:7.4, IE9:3.8, IE10:4.4, FF:18.3, CH:43.6, SF:7.8, MOBILE:27.5

  • #10
    New Coder
    Join Date
    Sep 2010
    Location
    High Wycombe, UK
    Posts
    26
    Thanks
    4
    Thanked 0 Times in 0 Posts
    Quote Originally Posted by rnd me View Post
    you can do both on the laptop; server don't use much CPU power.
    i simply thought you mentioned that you would rather work on the desktop...

    no sorry - i might have as my hands are always shaking when i am on this forum. i meant laptop. i have follow your instructions and now i am off to bed to sleep for a bit. efforts will resume tomorrow, along with posts on this forum regarding my failure.

    Thanks again,
    Morlaf
    Morlaf - Learning JavaScript!

  • #11
    Supreme Master coder! Old Pedant's Avatar
    Join Date
    Feb 2009
    Posts
    25,020
    Thanks
    75
    Thanked 4,323 Times in 4,289 Posts
    Quote Originally Posted by rnd me View Post
    IIS does not come with Home, but you can enable it on your laptop (which DOES have IIS) and still work on your desktop, assuming they are networked...
    Wrong answer. It *DOES* come with Windows 7 Home Premium. (And with Vista Home Premium, and with Windows 8 Home Premium.) It just that "Windows Basic" (or variations on that name) that it does not include it.

    That's what I'm using and I assure you I have *TONS* of stuff using IIS on it every day. (It's how I often debug before uploading to the windows server.)

    It's really easy to set up, per RndMe's prior post.
    An optimist sees the glass as half full.
    A pessimist sees the glass as half empty.
    A realist drinks it no matter how much there is.

  • #12
    New Coder
    Join Date
    Sep 2010
    Location
    High Wycombe, UK
    Posts
    26
    Thanks
    4
    Thanked 0 Times in 0 Posts
    well, i've done all that and now i have a few new tabs on my broser:
    Under tools i have: Activate Server, and Web Developer.
    and under web Developer I have lots of tools for bizarreness like: Webconsole, debugger, developer toolbar, etc, etc.... are these all the tools i need?!?!

    Thanks for all the help and sorry about the delay in responce....

    Morlaf
    Morlaf - Learning JavaScript!

  • #13
    Supreme Master coder! Old Pedant's Avatar
    Join Date
    Feb 2009
    Posts
    25,020
    Thanks
    75
    Thanked 4,323 Times in 4,289 Posts
    Ummm...what browser are you talking about?

    I don't see those with MSIE 9 or with Chrome.
    An optimist sees the glass as half full.
    A pessimist sees the glass as half empty.
    A realist drinks it no matter how much there is.

  • #14
    New Coder
    Join Date
    Sep 2010
    Location
    High Wycombe, UK
    Posts
    26
    Thanks
    4
    Thanked 0 Times in 0 Posts
    Firefox...........
    Morlaf - Learning JavaScript!

  • #15
    Supreme Master coder! Old Pedant's Avatar
    Join Date
    Feb 2009
    Posts
    25,020
    Thanks
    75
    Thanked 4,323 Times in 4,289 Posts
    Ahhh...yes. I see them. Except for "Activate Server".

    I'm assuming you installed an Apache web server, then?
    An optimist sees the glass as half full.
    A pessimist sees the glass as half empty.
    A realist drinks it no matter how much there is.


  •  
    Page 1 of 2 12 LastLast

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •