Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7860641
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 2, 20262026-06-02T22:22:14+00:00 2026-06-02T22:22:14+00:00

On my localhost, I am using the following JavaScript to create an iframe with

  • 0

On my localhost, I am using the following JavaScript to create an iframe with src, and add it to the document:

$('#preview').html('<iframe src="http://google.com/"></iframe>');

The iframe shows but not the content. In firebug, it’s just:

<iframe src="http://google.com/">
    <html>
        <head></head>
        <body></body>
    </html>
</iframe>

When I execute $('iframe').attr('src','http://google.com/'); on the console, the browser loads (says “Waiting for google.com…”), then seems to refresh the content of the iframe. But again, it’s empty.

If I set it to a local page, though, the content is loaded.

Is this because of the same origin policy? I’m not so informed about it. I did some googling and I’m confused because some sites say that it’s okay to include an iframe with src that doesn’t belong to your own domain, and some say it’s not possible.

By the way, since I’m still testing on localhost, would this work if I uploaded this to a server somewhere? (but src of iframe will still be in a different domain)

Help?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-02T22:22:18+00:00Added an answer on June 2, 2026 at 10:22 pm

    If you’d checked your browser’s error console, you’d have seen this message:

    Refused to display document because display forbidden by X-Frame-Options.

    So, this isn’t an error on your part, but a deliberate action on the part of Google.

    The two options for the X-Frame-Options are:

    • deny – no rendering within a frame, and
    • sameorigin – no rendering if origin mismatch

    References:

    • X-Frame-Options response headers, at MDN.
    • X-Frame-Options at Wikipedia.
    • Overcoming "Display forbidden by X-Frame-Options" (here on Stack Overflow).
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am using following prepared statement : Class.forName(com.mysql.jdbc.Driver); con=DriverManager.getConnection(jdbc:mysql://localhost:3306/mysql,root,root); String query=select ename from ?
I am using Jquery tokenizer as like facebook using the following plugin http://loopj.com/jquery-tokeninput/ which
I have following codes using smarty template engine In php file: $smarty-&gt;assign('SITE_URL', 'http://localhost/mis/'); In
I have the following html + jquery: <body> <head> <script type=text/javascript src=jquery.js></script> <script> $(window).load(function()
I have following url: http://localhost.com/phpdemo/bid/tf/red ? This url redirects through This [ $route['tf/red?'] =
I am using Jack as JavaScript mocking library. http://github.com/keronsen/jack . I am also using
I'm using the following step by step guide to connect to Facebook Connect: http://msdn.microsoft.com/en-us/windows/ee702803.aspx
Let's suppose I can access the following code: http://localhost/web/src/js/myApp.js Now I want to load
I got the following string: url(http://localhost/image/user/temp/n9cec42c939ab461cac7852c267413b1b.jpg) How can I extract the file name using
in my silverlight application I am using the webBrowser control. I call following javascript

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.