Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
859 views
in Technique[技术] by (71.8m points)

html - Generic solution of 'X-Frame-Options' to 'SAMEORIGIN' issue

I am trying to open http://teeSpring.com/ in an iframe. It is throwing Refused to display 'http://teespring.com/' in a frame because it set 'X-Frame-Options' to 'SAMEORIGIN'. error.
I have gone through multiple answers but none of it worked for me. Most of the solutions are specific to google-maps, facebook or youtube video.
Here is my code:

<html>
    <head>
        <base target="_blank" />
        <script src="http://code.jquery.com/jquery-1.11.0.min.js"></script>
    </head>
    <body>
        <iframe src="http://teespring.com" name="frame1" style="border: 0; width:20%; height:20%; overflow:auto;">

        </iframe>
    </body>
</html>

I did use target="_blank" but no luck.

Note: Trying to open third party pages. So I have no control over adding header or other meta data.

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

teespring.com is telling your visitors' browsers that they should not display it in a frame.

You have four options:

  • Talk to whomever runs teespring.com and convince them not to do that
  • Just link to them instead of trying to shove them into a frame
  • Don't point your visitors to them at all
  • Proxy their site and point the iframe at your proxy (this may step into copyright infringement territory)

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

1.4m articles

1.4m replys

5 comments

57.0k users

...