Access Denied using iFrame with jQuery in IE

Posted on 2014-01-10
Medium Priority
Last Modified: 2014-01-10
I’m trying to access the html in an iFrame with jQuery. I’m getting Access Denied in IE 11 and it’s not working in other browsers. The jQuery code and the iFrame page reside on the same domain. Also, this is a Dnn site if that matters.

The code below is how I’m testing, just trying to change the color of a button.

Any suggestion?


JQuery Code:

var frm = $("iframe").contents();

Open in new window

iFrame Form Code:

<form target="paypal" action="https://www.paypal.com/cgi-bin/webscr" method="post">
<input type="hidden" name="cmd" value="_s-xclick">
<input type="hidden" name="hosted_button_id" value="xxxx">
<table class="ppTable">
            <select name="os0"  class="ppDropDown">
                <option value="Orange">Orange </option>
                <option value="Red">Red</option>
            <input class="ppButton" type="submit" border="0" name="submit" value="Add to Cart" style="color: white;
                background-color: #FF8429; border: 1px solid #FF8429" />
<img alt="" border="0" src="https://www.paypalobjects.com/en_US/i/scr/pixel.gif"
    width="1" height="1">

Open in new window

Question by:rcl58
  • 2
LVL 58

Accepted Solution

Gary earned 2000 total points
ID: 39772506
If the URL of the iframe is different from the parent page you cannot access it.


Even if there is a slight difference in the iframe url e.g. www.mysite.com and the iframe url is mysite.com then they are different domains

Author Closing Comment

ID: 39772706
That was it! There was not "www." on my iFrame URL. Thanks
LVL 58

Expert Comment

ID: 39772713
Must have been my psychic powers coming out.

Featured Post

Get your problem seen by more experts

Be seen. Boost your question’s priority for more expert views and faster solutions

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

What is a Lightbox? A Lightbox is the effect you see when you click, for example, an image and the screen fades out and up pops the same image but in its full size dimensions. There are lots of Lightbox effects for jQuery. Problem is they are a…
Introduction Chart.js, used properly, can visually add a difference to your charting applications. It engages your visitors and allows them to interact with data they otherwise wouldn't be able to without expensive and complicated systems. For this…
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…

597 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question