-2

The following code in a PHP script used to work. But now it does not work any more. I tried with the URL directly and it works well. I replaced the URL with something else it works too. I could not figure out what could go wrong. Any ideas? thanks.

<div id="fragment-7">
    <iframe src="http://www.pathwaycommons.org/pc/webservice.do?version=3.0&q=TP53&format=html&cmd=get_by_keyword&snapshot_id=GLOBAL_FILTER_SETTINGS&record_type=PATHWAY"
            WIDTH="100%"
            HEIGHT="600"
            MARGINWIDTH=0
            MARGINHEIGHT=0
            FRAMEBORDER="NO"
            SCROLLING="AUTO">
    </iframe>
</div>
Tunaki
  • 132,869
  • 46
  • 340
  • 423
BIOROB
  • 1
  • 1
  • 3

2 Answers2

1

It might works fine. the problem is your url. please check it in source. I don't know exactly why. but the following below code works similarly

<iframe src="http://www.php.com/" width="200" height="200" marginheight="0"
                    frameborder="no"
                    scrolling="auto"></iframe>
  • Yes, I replaced the url with something else it works. however if I copy and past the url in my code in chrome directly it gets to the page with no problem at all, but not inside the iframe. – BIOROB Apr 07 '16 at 19:58
  • 1
    The reason may be like this (plz check it):- http://stackoverflow.com/questions/9158024/iframe-with-external-page-not-working – venkat venki Apr 07 '16 at 20:02
1

There's nothing wrong with your code, the page simply refuses to be framed by other domains.

The page returns the following HTTP header in the response headers.

X-FRAME-OPTIONS: SAMEORIGIN

The X-Frame-Options is a security feature by which a website can refuse framing. Since it is a security feature, there is no direct workaround unless you control the server you want to frame. The only thing you could do would be to proxy the request through a local PHP script or something similar.

Alexander O'Mara
  • 58,688
  • 18
  • 163
  • 171
  • Actually there is another iframe in the same script with a different url pointing to ucsc genome browser. It works fine. It looks like not all framing of external pages are refused. Anyone knows the criteria? thanks. – BIOROB Apr 08 '16 at 18:28
  • @BIOROB It depends on if the page sends the header above or not. – Alexander O'Mara Apr 08 '16 at 18:30