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 7586369
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T19:24:42+00:00 2026-05-30T19:24:42+00:00

I am creating an iframe using jQuery to a cross-site URL. This works properly

  • 0

I am creating an iframe using jQuery to a “cross-site” URL. This works properly in Firefox but IE is prepending the parent pages domain to the iframes src URL.

An example would be if I am creating the iframe (with jQuery):

<iframe src="http://www.google.com"></iframe>

The page that IE would try to load is:

http://www._mysite_.com/http://www.google.com

If I statically in the HTML create the iframe everything works fine. It is only when I make it using JS that it loads the wrong page.

I suppose I would understand if this was intentional cross-site protection that IE has built in, but I am wondering if that is the case, or if I am missing something.

Is this default behavior for IE? If anyone has a workaround it would be greatly appreciated.

EDIT:

Generated code is:

<iframe id="myIframe" width="500" height="400" frameborder="0" src="http://www._website_.com/aaa/bbb/ccc">

I tested the generated code at static HTML and it did work properly in IE.

EDIT 2:

This is how I am creating the iframe:

jQuery('.signUp').live('click', function() {

    var url = 'http://www._website_.com'+$(this).attr('href');

    var thisModal='<div id="dialogRes" class="windowG"><iframe id="iframeG" frameborder="0" width="500" height="400" src="#"></iframe></div>';

    jQuery('body').append(thisModal);

    jQuery('#iframeG').prop('src', url);        

    return false;

});

On this line:

jQuery('#iframeG').prop('src', url);        

I have tried attr() as well as removing it all together and just putting the url in the src tag of the iframe. Nothing seemed to work.

  • 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-05-30T19:24:43+00:00Added an answer on May 30, 2026 at 7:24 pm

    The problem is that in IE, the href attribute is always returned as an absolute URL. So if you had

    <a id="demo" href="bar/baz">...</a>
    

    Then your on your website http://mydomain.com/foo:

    jQuery('#demo').attr('href') == 'http://mydomain.com/foo/bar/baz';
    

    Two options to work around this are to either parse out the (possible) full domain from the href attribute, or to use a different custom attribute just to hold the target address/path (eg data-href).

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have an iframe that I was formally creating using a url with some
I am creating application in facebook using iframe. In that i want to redirect
I'm creating a site using drupal where I'd like to prompt my new users
I am creating a custom WYSIWYG using editable iframe.I want to add a Custom
I'm creating a simple app with jquerymobile build with phonegap which is using iframe
I'm using this for creating twitter follow buttons on my twitter web-app. Implementation is
Basically I have an IFRAME that displays a given page. I am using jQuery
Creating Traversals for Binary Search Tree with Recursion. void inOrder(void (*inOrderPtr)(T&)) { if(this->left !=
(creating a separate question after comments on this: Javascript redeclared global variable overrides old
I m using jquery validator plugin. i need to validate some field with some

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.