Javascript Created IFrame Document, Weird Domain Issue

Aug 3, 2005

I have an IFrame whose document is created completely by Javascript code at
runtime. The document in the IFrame accesses Javascript functions in the
top level document. This works fine most of the time. But every now and
then, when I hit the back button, the browser suddenly thinks the Javascript
created document in the IFrame is not from the same domain as the topmost
document, and therefore I start getting "permission denied" errors when I
try to access the top level document's Javascript functions.

If I look at the IFrame document's properties (Mozilla->This Frame->View
Info), it shows the expected URL with a domain name that matches the top
level document.

View 2 Replies


ADVERTISEMENT

JQuery :: Get Document & Body Of A Newly Created Iframe?

Aug 16, 2010

There must be a standard way of getting the body of an iframe, and adding content to it, using jQuery. what the "best practice" way is? That works in all browsers?

View 2 Replies View Related

Document.domain - Not Accurate ?

Jul 28, 2011

Okay, reason I say that is, its not accurate to the actual domain that the "script" is located on.

For example, domain.com has the <script url=domain2.com/jsfile> which has " document.domain " (this = domain.com)

However, if i have frame of domain3.com which frames domain.com the domain will show domain3.com but thats not what I care about, I want domain.com since thats whats actually being shown.

View 6 Replies View Related

Catch Invalid Document.domain Set ?

Mar 23, 2010

I do my development on a local PC before putting the code onto a website.

Something I need to do is set the document.domain to the top level domain for a page. The top level domain will be supplied via config item.

The small issue is that my top level domain when developing is "mypc" and attempting to set document.domain to "mypc" kills the javascript.

I tried this as a work around:

Code:

But this still triggers a complete failure of javascript on the page. I also tried using eval to do it, but it still kills things.

It there another trick to try setting the domain without dieing that doesn't involve validating the domain string before attempting to set it?

[Edit] I am aware that it's dieing because "mypc" is clearly not a FQDN as it expects.

View 4 Replies View Related

Document.domain Or Window.location.host ?

Mar 3, 2009

I need to get the domain of the page (mydomain.com) There seems to be 2 variables to get this info. document.domain & window.location.host - Both are set in FF & IE. So whats the difference between these ?

View 1 Replies View Related

Get URL Of Iframe - External Domain

Jul 11, 2007

Is there ANY way to get the URL of an iframe if the page the user is on is an external domain? I know this is normally blocked by the "Same Origin Policy", but I'm just trying to find out if there is SOME workaround. All I'm trying to get is the URL.

View 1 Replies View Related

Close Iframe That's In Another Domain?

Nov 27, 2011

I'm using lytebox to open an iframe, but the iframe url is in another domain that the parent window. i need to close the iframe when user clicks a button. I can do that with javascript : top.$lb.end(); the $lb.end(); starts lytebox scripts in parent window which close the iframe and modify all the css stuff. That works when my iframe url is in the same domain. But when it's in another domain, that does'nt work.

[Code]...

View 7 Replies View Related

GetSelection() In IFrame Different Domain?

Oct 24, 2010

Is there any any ANY workaround for getting highlighted text in an iframe that is displaying a different server's site (like google for example) and storing it in a variable?I know about the Same Origin Policy, but come on. This is just highlighting text. Why can't we highlight text in an iframe?! It's the same as copy and paste, just quicker.

View 1 Replies View Related

Document.domain Issues And Cross Server Scripting

Jul 23, 2005

I'm working on a project at the office that pulls together a bunch of
our websites into a portal thing and adds a better search engine. We're
also trying to accomadate newer browsers (Netscape 7.2, Firefox,
Safari) and are having some problems. The websites run on different
servers, all of which we control, so we are setting the document.domain
= "ourdomain.com"; in some javascript on ever page. However, we're
having problems. We use popup windows for some things, and sometimes
these popups want to 'populate' the parent frame window with a new page
as a result of a user selection on the popup.

This works most of the
time, but not always. For instance, in Netscape 7.2 it just seems to
fail with an "access denied..." error in javascript. In Firefox and
Safari it opens a new window and populates that instead of populating
the original parent window. Can anyone point me at some definitive
information about the document.domain property and how to use it
effectively?

View 1 Replies View Related

Cross Domain IFrame Is Not Traversing?

Dec 8, 2010

JavaScript code is not traversing via Iframe with Cross Domain. Actually i was assigned with a project, to grab the top page URL, which has many Iframes, which are coming from different domains. The final sub domain has the JavaScript code, which has to grab the top page URL.

View 2 Replies View Related

IE With Cross Domain Iframe Resize?

Jan 31, 2010

I'm using some javascript that senses the presence of an id on a page, creates an iframe containing cross domain content if it finds it and also resizes the iframe. It works great in FF, but IE stumbles if there's more than one iframe requested (especially IE6). If someone knows a better way to get IE to co-operate with this set up An acceptable alternative would be to only create one iframe at a time (which IE can handle), by using a link to trigger the iframe creation. I just can't figure out how to get that to work.The cross domain resizer uses the frame manager trick, the rest is homespun.

Code:
<!--JS THAT RESIZES IFRAMES-->
<script type="text/javascript" src="documents/FrameManager.js"></script>
</script>
<!--POSTS-->
<script>

[Code]...

View 5 Replies View Related

Cross Domain Iframe Resizing?

May 8, 2011

i am trying to resize an iframe which is not in same domain.I tried couple of ways as below: iam loading an html which is in other domain.I kept this syntax in script

function toBeCalledOnChildHTMLLoad()
{
parent.document.getElementById("ifameId").height = calculatedHeight;
}

Still it is not working..Please suggest if u have any solutions on this.

View 5 Replies View Related

Detect ,on Load Of The Html Document, Whether The Body Of The Iframe Document?

Sep 6, 2009

Suppose a HTML document has a iframe. Using javascript,I want to detect ,on load of the html document, whether the body of the iframe document is ready to be displayed.I want to be able to overwrite the the body contents (before it actullay loads) of the iframe.can I do it with jquery? say if ,HTML doc is

Code:
<html><head></head><body><iframe id="ifrmId" src="http://www.google.com" ></iframe></body></html>

View 1 Replies View Related

JQuery :: Allow Iframe From Remote Domain Have Access?

Jul 17, 2009

I'm trying something along these lines:

[Code]...

View 1 Replies View Related

JQuery :: Styling A (same Domain) Iframe Not Working In IE?

Dec 14, 2011

I'm displaying 2 iframes on a page with content from other pages on the same domain. I'm using jQuery to apply a stylesheet to the 2 iframes.

$('#col1iframe, #col2iframe').load(function(){
$(this.contentDocument).find('head').append('<link rel="stylesheet" href="css/iframe-styles.css">');
$(this.contentDocument).find('a').attr({"target":"_top"});

[Code]...

View 5 Replies View Related

Cross-domain Iframe Parent Checking?

Jul 2, 2010

I'm currently developing an application (in php) for a website that is to be integrated into their website using iframe. It's imperative that it's done using iframe as I am placing the application on my own server. In short, the iframe element appears on my customer's website (lets say customer.com) - something like this:

<iframe width="440" height="500" frameborder="0" scrolling="no" src="http://www.myserver.com/index.php"></iframe>

However, it's quite imperative that my application (i.e. what's located at myserver.com/index.php) only can be shown in iframe elements placed at customer.com. That is: I want to make sure that a similar iframe element from another web server (lets say anothercompany.com) has the possibility to iframe my application located at myserver.com.

My first idea was to check this using php in my application: by looking at HTTP_REFERER, I can get the location of the page containing the iframe element. That solution seems to work fine. However, as is well known, it is possible to spoof and even hide the http_referer server variable. Still, as I only want to make sure that no other server accesses the application through an iframe object, it should perhaps be an okay solution - if someone wants to access the application from their own browser, and spoofing the HTTP_REFERER variable, I'm fine with that. (I just want to make sure that only customer.com, and not anothercompany.com, can integrate the application with an iframe).

The other thought I had was to use javascript and DOM stuff. The idea is then to use javascript to check that the application has a parent frame and that its location is at customer.com. However, as we are dealing with two different domains here, I'm having a lot of problems getting the document.parent.location variable - it's not allowed!

Any solutions on how to do this in javascript? Any way to bypass the obstacle above? Or perhaps javascript isn't the best way? My guess is that there is a solution out there somewhere - I guess there are a lot of ads that are integrated into various websites using iframe, and where the actual content (i.e. what's inside the iframe element) can check which server is embedding the ad through an iframe element.

View 2 Replies View Related

Pulling Title From Iframe Cross Domain?

Aug 18, 2011

Anyone know if there is a way to get the title string from an iframe src coming from another domain?

View 6 Replies View Related

Dynamic Iframe Height With External Domain Src?

Mar 5, 2009

I am trying to get an iframe to have dynamic height - I want it to resize to fit the contents of the page.There is a four or five step process within the iframe. So for example, page 1 is rather short, and it'll have a link that sends you to page 2, which might be rather long.I have no control over the pages I am using in the iframe and they are on another domain.I have googled and and searched the forum and I've yet to find anything that works. A lot of them say they're not cross-browser compatible, but I haven't gotten anything to work how I'd like in any browser.I'd like to do it without jQuery.

View 4 Replies View Related

Cross-domain Iframe Communication In Opera?

Feb 11, 2010

I have need to communicate between two iframes of the same domain, which live inside a parent page on a different domain that I have no control over. This is a Facebook app and the basic layout is this

apps.facebook.com/myapp
L iframe1 (src='mysite.com/foo')
L iframe2 (src='mysite.com/bar')

I need frame1 to talk to frame2, but in Opera I can't access window.parent. frames['frame2'] to do the usual cross-domain methods (updating location.hash for example) Is there an alternate way to accomplish this in Opera?

View 5 Replies View Related

Target And Alter <iframe> Contents From Another Domain?

Aug 3, 2011

I want to add some classes to various bits on one of Worldpay's lovely payment iframes so I can make it look something like the site it's sat on.

This is the original principle I was using, which works when on a page with the same domain.

Code JavaScript:
$('#worldpay').load(function(){
$(this.contentDocument).find('body').html('Test: This frame was modified with js')
});

View 2 Replies View Related

Adding Styles To A (same Domain) Iframe Not Working In IE 8/7

Dec 20, 2011

I'm displaying 2 iframes on a page with content from other pages on the same domain. I'm using jQuery to apply a stylesheet to the 2 iframes by appending it to the head.

Code JavaScript:
$('#col1iframe, #col2iframe').load(function(){
$(thiscontentDocument).find('head').append('<link rel="stylesheet" href="css/iframe-styles.css">');

[Code]....

View 1 Replies View Related

JQuery :: Iframe Auto-height Adjust For Cross Domain Use?

Dec 14, 2010

I'm wondering if anyone out there has a solution to using an iframe that automatically adjusts it's height of the child and also works cross domain.

View 2 Replies View Related

Posting FORM Data To A Cross-domain IFrame Call?

Apr 9, 2009

I'm writing a web page, which should interact with pages on another server using an iFrame. I want to use a form on the parent page to post to the URL on the iFrame and capture the response, without reloading the parent page.

Here are the details:I have a FORM on the parent JSP page, with some session data in hidden fields. The point to note is that the whole session data is on the client side, in encrypted form. This data should be posted to the server for each request, synchronous or asynchronous.Now, I need to call an application on a server on a different domain. For this purpose, I am using an iFrame. The session data in the parent page should also be passed to the application in the iFrame.

View 2 Replies View Related

Closing The Iframe Window Of Main Domain Which Is Opened From Subdomain?

Apr 12, 2010

I have problem with closing the Iframe of main domain window and this window is opened from the subdomain.

For eg: I have www.example.com , which has a page sendto.aspx and I open it in Iframe from subdomain sps.example.com.

This Iframe is not closing if I say self.close(), window.close(), window.parent.close() and nothing works for me.

I also checked that the current domain is example.com when I try to alert with document.domain.

View 1 Replies View Related

Add 'name' To Dynamically Created Iframe

Nov 1, 2006

If I do this:

el = document.createElement("iframe");
el.src = "test.htm";
el.name = "frm"; // or el.setAttribute("name","frm");
document.body.appendChild(el);

the iframe gets created but the 'name' attribute is not added under IE
6. I tried setting the 'name' after appending the iframe but still no joy.

How can I add a 'name' attribute to an iframe so that IE 6 sees it?

View 1 Replies View Related

Getting Error : New Line In Alert Created By Document.write / Way Around This?

Apr 9, 2010

I am trying to insert new lines inside an alert that is created by the document.write method. This causes the error "unterminated string constant". Is there any way around this? code...

View 3 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved