Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

IFrame Sometimes Not Loading Right 3

Status
Not open for further replies.

BoulderBum

Programmer
Jul 11, 2002
2,179
US
Okay, so I have a need to embed a page in my web app that's a view of a website on another of our servers. I started to use an iframe because there was a problem with using object (a security warning, and I forget what else), but sometimes the iframe doesn't load: it's blank until it's refreshed.

1. Is there a different way to embed a remote page that works better?
2. How do I get the iframe to be more reliable?
 
1. Yes - server-side scraping. That way avoids all security issues, too, but you should ask in the forum for whatever server-side scripting language you can use.

Hope this helps,
Dan



[tt]Dan's Page [blue]@[/blue] Code Couch
[/tt]
 
How do I get the iframe to be more reliable?
Iframes work fine. If you are having a problem with your page not loading in an iframe, it'll be because the target page is not available (when it is requested) or because you are doing something with javascript to either affect the DOM or the iframe src - and not doing it correctly.

Let us know which!

Cheers,
Jeff

[tt]Jeff's Page @ Code Couch
[/tt]

What is Javascript? FAQ216-6094
 
on a side note, is there a way to change the "HREF" of an iframe, rather than the SRC , i've found dynamically changing the SRC of an iframe loads a cached version of the page, if it was a standard frame and I used document.location.href, the page loads fresh each time.

i've tried document.getElementById('iframeid').location.href , but it errors saying 'location is not a property'

"In complete darkness we are all the same, only our knowledge and wisdom separates us, don't let your eyes deceive you.
 
Yeah, I sometimes to do that for images when I'm having trouble with cached versions of the image being shown.


____________________________________________________________

Need help finding an answer?

Try the Search Facility or read FAQ222-2244 on how to get better results.

 
Jeff,

The target page seems to come up fine when cutting and pasting the URL to the browser, and I don't touch it with scripts.

BillyRay,

Do you know if the scraping strategy will work if the embedded content is a web application in itself? I worry that serving up the content after scraping might leave the application trying to post to my site's page (assuming that I'd be rendering through something other than an iframe).

1DMF,

No helpful suggestion, but I just wanted to say I saw the same problem with loading XML files into iframes once! With that and this latest problem I'm facing, I'm beginning to think that iframes in IE are a little brittle.
 
if you want to parse XML, try the AJAX method.

you also might be experiencing CROSS-DOMAIN security issues, suck as cookies.

If you have a frame or Iframe, the browser must be set to allow cookies from the domain loading in the frame.

If you do not have this set, the browser sees a domain NOT in the PARENT window trying to use cookies or do something which is not allowed either by Cross-Domain security or cookies settings.



"In complete darkness we are all the same, only our knowledge and wisdom separates us, don't let your eyes deceive you.
 
BoulderBum,

The problem is in your code.

Dave


~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
O Time, Strength, Cash, and Patience! [infinity]
 
LFI. Like I said, all I did is have an IFrame in a page. Not much I can screw up there, but if you haven't noticed rendering bugs in IE, you haven't been hanging around the web for long enough.

Actually, it's not that I don't appreciate the suggestion, it's just that the diagnosis doesn't make sense for the circumstances.

It seems unlikely that the target page itself is the problem since it's consistent when loaded by itself in the browser, and, as mentioned, it actually works most of the time in the IFrame, just usually not the first time for some reason.

I also didn't touch the IFrame with script until now (I have it reload when the page is done loading), so that's sort of a dead end and doesn't get around why it loads sometimes and not others.

1DMF,

Thanks, man. For the situation, I was actually loading XML files (not parsing them) straight from a web server.

That cookie idea sounds worth investigating, but any idea why it would be hit-or-miss with the loading?

 
BoulderBum,

Does your page work consistently in other browsers?

Even though you describe your code as simple and straightforward, perhaps you can post it... just for grins?

Dave


~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
O Time, Strength, Cash, and Patience! [infinity]
 
That seems like a fair challenge, but here's the hokey part: the embedded site uses ActiveX controls so I can't really test it on other browsers and it references an intranet page anyway so I couldn't just send over an example. Doh!

I can say with certainty that I always get an activeX incompatibility message in the IFrame with FireFox. :)
 
Thanks, man. For the situation, I was actually loading XML files (not parsing them) straight from a web server.

Sorry my choice of words threw you a bit, I don't beleive AJAX parses the XML file it just gets you it.

I use it to supply me HTML for rendering and update the DOM's inner.HTML with it.

Basically it asyncranously fetches either an XML file or HTML/TEXT, which can be supplied by the webserver or server side scripting such as PERL cgi.

as for the cookies thing, I experienced a problem where i had a page made of frames, the frame was loading someone elses website, which used cookies, until i set the broswer to allow cookies from the domain that was loading in the frame the page just stayed blank/white.

i'm not sure if this is what your experiencing, intermittent sound ominous, I found it didn't work at all until the cookies was set.

without seeing your code or knowing the content of the page trying to load into the frame it's dificult to diagnose.



"In complete darkness we are all the same, only our knowledge and wisdom separates us, don't let your eyes deceive you.
 
Yeah, I've worked with AJAX before (I like the AJAX.NET library/ C#). It's great for many situations (and not only for XML)!

We also considered writing the XML file to the response stream (via server controls) on the server-side. The problem was that we just loved IE's built in way of handling XML files (with the color-coding and collapsible elements and stuff) so we decided to let the browser do the dirty work of rendering with the IFrames. Unfortunately we ran into that caching problem. :-/

Sorry about not being able to send the latest example, too. I know it's rather "convenient". Maybe I can strip out the intranet stuff later...



 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top