Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Web Development
  3. Iframe problem

Iframe problem

Scheduled Pinned Locked Moved Web Development
sysadminhelpquestion
2 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • J Offline
    J Offline
    josephong
    wrote on last edited by
    #1

    Hi All, I have create a web page in my local host. The web page has a Iframe which only able to work on my computer when i type "http://localhost/" to view it on my own computer. When im using my Colleague computer and type my computer's IP Address which is connected to the same local area network. The whole Web page expect the Iframe part works. The code for the Iframe is <iframe src ="http://localhost/cgi-bin/6\_nodeid.cgi" width="28" height="40" scrolling="No"> <p>Your browser does not support iframes.</p> </iframe> But if i type just "http://localhost/cgi-bin/6\_nodeid.cgi" ( where the 'localhost' is replaced by my computer's ID ADD) in my colleague's computer, it works. Any possible solutions?

    enhzflepE 1 Reply Last reply
    0
    • J josephong

      Hi All, I have create a web page in my local host. The web page has a Iframe which only able to work on my computer when i type "http://localhost/" to view it on my own computer. When im using my Colleague computer and type my computer's IP Address which is connected to the same local area network. The whole Web page expect the Iframe part works. The code for the Iframe is <iframe src ="http://localhost/cgi-bin/6\_nodeid.cgi" width="28" height="40" scrolling="No"> <p>Your browser does not support iframes.</p> </iframe> But if i type just "http://localhost/cgi-bin/6\_nodeid.cgi" ( where the 'localhost' is replaced by my computer's ID ADD) in my colleague's computer, it works. Any possible solutions?

      enhzflepE Offline
      enhzflepE Offline
      enhzflep
      wrote on last edited by
      #2

      The line

      <iframe src ="http://localhost/cgi-bin/6\_nodeid.cgi" width="28" height="40" scrolling="No">

      gets processed on the client computer, not the server. So when you run it on your computer, it points to something on your machine. When you run it on your colleague's machine, it points to a resource on their computer. The way around this is to have the server set the "http://localhost/" part of the address at the time the page is served, or to hard-code the ip of your machine (which will work fine for local, intranet pages) What you've been doing manually (replacing the address) is something you need to do automatically. (you can check the ip of the client and do nothing if its 127.0.0.1 or set it to the IP address of the server if the client request originates from a machine other than the server) Without knowing your requirements etc, I can't see any reason not to make the server automatically insert it's own IP regardless of who the client is. This way the software will be portable between machines :) without needing to change the hard-coded IP address each time. :doh:

      1 Reply Last reply
      0
      Reply
      • Reply as topic
      Log in to reply
      • Oldest to Newest
      • Newest to Oldest
      • Most Votes


      • Login

      • Don't have an account? Register

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • World
      • Users
      • Groups