Build Your Own Arcade Controls Forum

Main => Everything Else => Topic started by: Dartful Dodger on January 26, 2007, 05:12:06 pm

Title: html JavaScript variable question
Post by: Dartful Dodger on January 26, 2007, 05:12:06 pm
This should be simple, but it's Friday and I'm tired so I'm not thinking straight.  I should post this to a JavaScripting site, but you guys usually reply faster.

I have an application that opens up a webpage.

The application is on the hard drive and the webpage is on a cd.

I need to be able to pass a variable from the application to the webpage, to add to the nonsense this needs to be cross platform.

I've tried to open up the webpage using this type of link:

myPage.htm?myVariable=test

The application can open up "myPage.htm", but when I add the "?Myvariable=test", it gives me a page can not be found.

I'm not concerned if the user can see the variable.

I also need to know what code goes on the html page to read the variable.

Thanks for any help
Title: Re: html JavaScript variable question
Post by: AlanS17 on January 27, 2007, 03:05:04 am
Are you opening it as a http or as a file? Only http request from a dedicated server will read javascript correctly (I think). It's two AM and I'm drunk so I'm not 100% sure on that.
Title: Re: html JavaScript variable question
Post by: patrickl on January 27, 2007, 04:40:51 am
Javascript will run fine with html files from a CD. Passing variables will not work when you don't have a web server. A webserver will translate the ?Myvariable=test part to a variable. If the file resides on a CD there is no translation and the file is looked for literally
Title: Re: html JavaScript variable question
Post by: Dartful Dodger on January 29, 2007, 01:05:07 pm
Thanks, I figured it was something like that but I wanted to make sure before I wrote it off as an option.

I'm going to start working on plan B.

The website is in frames so I'll write an installer program that creates the start html with the frames and the navigational html page on the user's harddrive.  These pages will have the directories hard coded in the html.

This might end up being the easier and more efficient way to handle this.

Thanks again.