dcsimg
www.webdeveloper.com
Results 1 to 6 of 6

Thread: access local html page through "file:///"

Hybrid View

  1. #1
    Join Date
    Oct 2012
    Posts
    9

    access local html page through "file:///"

    I installed LAMP
    and I want to use ajax to write some client information into mysql server on the server side.
    I want to test a anonymous browser.
    however, with this browser, pages like "http://localhost/test.html" can't be accessed because the browser can't establish a connection to the server at localhost.
    but it can access the page through: file:///var/www/html/test.html

    however, my intention is to use ajax to write some client information into mysql server on the server side, so through file:/// can't achieve this goal,
    are there any potential solutions for this?
    thanks!

  2. #2
    Join Date
    May 2012
    Location
    St. Helens, UK
    Posts
    74
    If you can't connect to your page by using localhost it sounds very much like your web server isn't running.
    What happens when you try and (re)start Apache from the command line? Does it spit out any error messages?

  3. #3
    Join Date
    Oct 2012
    Posts
    9
    it is running, but the browser has some settings that disallow it to access localhost
    I'm just wondering whether it is possible to log client information to the server sql database if I use "file:///"

  4. #4
    Join Date
    May 2012
    Location
    St. Helens, UK
    Posts
    74
    > it is running, but the browser has some settings that disallow it to access localhost

    Really? How does that happen? Are you using a computer that has certain settings restricted beyond your control? Every browser that I've ever used can connect to localhost / 127.0.0.1 - with the possible exceptions of Internet Explorer and Safari, but given that they don't run on Linux I haven't used them for aeons.

    > I'm just wondering whether it is possible to log client information to the server sql database if I use "file:///"

    It depends which languages you're using. PHP will only run via an intermediary web server. JavaScript will work.
    Even if you don't need PHP and can get by just with JavaScript, I'd caution against it. Your development environment should mirror as closely as possible the environment in which you eventually deploy your work, e.g. if the server where you anticipate deploying your work is running Debian 6, then do your web development on an instance of Debian 6. (this is where virtual machines come in hand.)
    Otherwise, you'll be prone to finding that certain things don't work exactly as you expected when your work is set to go live.

  5. #5
    Join Date
    Oct 2012
    Posts
    9
    I just want to use youtube API to get some statistics information and log these information
    but I can't use javascript to create files for logging these information on client side, so someone suggests me to set up a webserver and use ajax
    however, I'm investigating Tor browser bundle and this browser can't access localhost
    I don't want that the webserver locates in another machine, because I don't want the delay between the client and the server (it can be several seconds due to Tor browser routing)

  6. #6
    Join Date
    May 2012
    Location
    St. Helens, UK
    Posts
    74
    Oh, I see.
    In that case, the best idea I can think of would be to write a program in JavaScript that periodically appends the relevant information to your browser window, preferably in a convenient data interchange format such as JSON. Then, when you've got the information you need, you could save the data from your browser window as a text file, process it with a scripting language of your choice (virtually every language under the sun supports JSON) and then input it to your MySQL database. Well, that's probably how I'd attempt to do it. Can't really offer any more specific advice - unfortunately know nothing at all about the YouTube API.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

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



Recent Articles