I am trying to load an iframe, get an part of his content and delete the iframe.
My solution works on FF, Chrome but fails sometimes in all IE versions.
When I load an page in browser I see the its full content, but when I load exactly the same page in iframe there are missing elements from the page.
I've tried to add the iframe by hand from console and sometimes the page load all its content ,some times it doesn't.
Does anyone have a clue why does this happen?
i believe that not declaring DOCTYPE (in both the iframe source and the parent) can cause issues like that.
undeclared doctypes can cause the browser to revert to quirks mode
Related
Good day,
I have a problem with IE and iframes.
So I have a huge application with legacy code, designed in early 2000. iFrames are used everywhere.
When something big is loaded inside the iframe, there is no display in browser throbber. So the loading icon starts spinning only when the main page is loaded, not iframes, so its impossible to say if anything is happening at all.
The users complain, that IE10+ gives them this problem, earlier versions worked. For me IE9 also has this issue.
Unfortunately, it is impossible to use JS on every page and manually add the 'loading please wait' icon or message, there are more than 100 pages with more then one iframe on each.
Chrome works fine, but nothing except IE can be used.
Could you please recommend solution for this trouble?
Right now I have a webpage that renders differently on internet explorer than chrome. I want to load an iframe that holds this webpage. When the webpage is shown within the iframe I want it to render in the way it renders on Internet Explorer. Is there a way to ensure that even users who run this application on chrome/firefox will see the iframe loaded with the internet explorer configuration? I was not sure if the iframe automatically conforms to the browser the webpage is being run on or if there is a way to change the iframe to have it render the way a specific browser would?
No, the page within the iframe will be rendered by whatever browser is rendering the parent page.
Instead, you should focus your efforts on developing a website that operates correctly in all of your target browsers rather than just IE.
There is a vague chance you can do it with CSS but it's highly unlikely. What renders web pages in a certain way is the browser of the user themselves. That's what translates the HTML and that's why your code looks different, because Chrome translates it one way, and Internet Explorer a different way (by the way no one uses IE since XP).
I have a webpage from https://creator.zoho.com that contains an iframe. The iframe scr is http://somedomain.example.com (NOTE that it is not https). The iframe content contains scripts for JQuery, SignalR etc.
I get the following behavior across OS and browsers with their default security settings:
Windows
Internet Explorer - No issues, works fine.
Chrome - Does not load the iframe context at all (I see the DOM of iframe and it is empty). A shield icon appears on the right of the address bar and on click the message is "the page includes scripts from unauthenticated sources." I have an option "Load unsafe script". I click it and everything is works.
Firefox - Does not load anything in the iframe. No security indicator nor any warnings.
Safari - No issues, works fine.
Mac OS
Chrome - Does not load the iframe context at all (I see the DOM of iframe and it is empty). A shield icon appears on the right of the address bar and on click the message is "the page includes scripts from unauthenticated sources." I have an option "Load unsafe script". I click it and everything is works.
Firefox - Does not load the iframe context at all (I see the DOM of iframe and it is empty). A shield icon appears on the left of the address bar and on click the there is a security related message. I have an option "Load unsafe script". I click it and everything is works.
Safari - Does not load the iframe context at all. No security warning. No indication that something is blocked.
Does anyone have a clue as to what is wrong?
After a good amount of Googling, I can came across - https://developer.mozilla.org/en-US/docs/HTTP/X-Frame-Options - but not very sure if this is a solution for my case for all browsers OR if it is even the right solution for any browser for the situation that I am facing.
Thanks in advance for reading my post.
My problem was resolved by moving the application (that was loading in the iframe) to HTTPS. So now the parent page and the iframe both are on HTTPS. They still on different domains, but both being HTTPS solved the issue for me.
Precondition:
I have an aspx-page with iframe inside. This iframe points to the url handled by MVC on the same site (it's hybrid site, both standard ASP.NET and ASP.NET MVC). The resulting page rendered by MVC contains a lot of scripts references.
Problem:
IE9 throws an exception on every single script it load in iframe. These exceptions are similar to this one:
Error: 'Function' is undefined
That is, it says that the most basic things every window has is somehow absent. Once you clicked through all of these popups, the page just works as designed!
If I load a URL from <iframe /> src attribute in the browser directly, everything works as expected.
If I open the page in another browser (I tried Opera, Firefox), everything works as expected -- no errors.
So, what IE9 wants?
There is this msdn page about this bug (or feature).
You get these kinds of errors when you move the iframe element around in DOM. In such cases, IE 9 garbage collects the iframe (causing your undefined bug) and reloads it at another position.
In general, you should create the element, set its src attribute only once and then put it somewhere in the DOM tree once. It has nothing to do with the code which runs in the iframe itself.
I have encountered this same situation in the wild. Basic symptoms:
You load script code in an iframe
The script code runs early (from the head section or top of body)
IE complains about some missing native object
I found that it can often be prevented by delaying the execution of the script code until onload or DOMContentLoaded... Not much help I know but this is one of the most difficult IE scripting bugs I have ever encountered. I upped the score of your question, hope it will be found by others as well and we can get a more detailed answer.
Also see this question:
Error in Internet Explorer 9 (not earlier versions or other browsers) when including jQuery in an iframe
Placing the following script block at the very top of the iFrame html <head> seems to resolve the issue in my case. Basically, it forces the iframe to reload, which as some have pointed out, solves the issue. It seems relatively safe, because, without things like 'Object' and 'Date', javascript is essentially useless.
<script type="text/javascript">
if(typeof(Object)==="undefined"){
window.location.reload();
}
</script>
Try loading the javascript at the end after complete web page is loaded. I feel the script is executing even before the iframe is completely loaded.
for some suggestion of scripting in IE9 view the given link below
http://blogs.msdn.com/b/ie/archive/2010/06/25/enhanced-scripting-in-ie9-ecmascript-5-support-and-more.aspx
Further investigation revealed that the solution is to add the offending iframe to it's dom location BEFORE setting the 'src' attribute.
Once the 'src' has been set, changing location of the iframe within the DOM stack forces IE9 to garbage collect it.
Once 'src' has been set, iframe can be resized and changed via css positioning, but cannot change the relative location in the DOM stack.
Often times, plugins like dialogs and lightboxes will stuff an iframe with src already set into the dom, then append / prepend or whatever, triggering the GC to take place.
function waitForjQuery(){
if(typeof jQuery!='undefined'){
//Do yor stuff!
}
else{
setTimeout(function(){
waitForjQuery();
},500);
}
}
waitForjQuery();
I have a main frameset page, which uses the FRAMESET doctype..Now this has 3 frames inside it..
Now for the 2nd frame, I want to use some HTML5 code ()...So guess I'll have to use the doctype
Now my question is; can both these doctypes co-exist, which means can I declare FRAMESET doctype for the main frameset page and HTML5 Doctype for one of the frame page..
Can it cause any cross-browser issues?
Also before you say, I know this is a strange question as I am using old/outdated frameset with the latest HTML5...But I have limited options (In fact, can't edit the main frameset page to use iframes)...So want to know how can I combine the 2?
Doctypes are specific to documents and each document has its own independent doctype. Having a different doctype in each frame is perfectly valid, and having the doctype of the frameset be different from the doctype of the frames is not only valid, it's impossible for it to be otherwise. Whether it's HTML 5 doesn't really enter into it.
Now my question is; can both these doctypes co-exist, which means can I declare FRAMESET doctype for the main frameset page and HTML5 Doctype for one of the frame page..
They are separate, independent documents, so: yes.
Apparently the answer is no because as usual, Internet Explorer. This link: http://css-tricks.com/ie-iframe-quirksmode/ is validating my findings that my html5 document loaded inside of a frame loaded inside of a much older parent document with frameset doctype is rendering in quirksmode because "In IE, iFrames on Pages in Quirks Mode Also in Quirks Mode". It sounds like this is the case with Frames as well as IFrames even in IE11.