Forum Moderators: open
A page with an iframe wasn't loading its src in Safari; though it was ok in Firefox, the Safari src was "about:blank".
<iframe class="mt_big mb_big" width="170" height="300" src="[my src file, removed here]" id="photo_frame" name="photo_frame" scrolling="no" style="border: 1px solid #000000;">
</iframe>
The src file loaded fine by itself in a tab, and validated at the W3C site.
So I kept deleting chunks of the code (a PHP page) and retesting; finally I had about a 10-line PHP file, with no actual PHP or Javascript or anything in it, with the iframe the only thing in the body. It still didn't work.
I copied this to an html file (test.html)... and it WORKED! Same exact file; the HTML version loaded the src while the PHP did not.
Finally narrowed it down to the id and name attributes of the PHP's iframe tag: if either is set to "photo_frame", it will not work.
I could not find a single mention of this anywhere on Google. My computer came within 5 minutes of being beaten with a baseball bat. Just wanted to post about it and ask if anyone else had heard of anything like this. I couldn't find information online about ANY reserved or invalid ids, Safari or otherwise.
I went back to the original, full PHP file, changed the id and name in the iframe to something else, and the src loads fine now.
Oh yeah, I tried (in the tiny PHP file):
<p id="photo_frame">Hello</p>
in the body instead of the iframe and it worked. It's only Safari, only PHP files, only iframe tags, and only "photo_frame" as name or id.
Sigh. How is any of this possible?
Apparently, the problem is that Safari has a very aggressive cache for iframe src's. It doesn't cache actual contents, but stores the src value based on an iframe's id. Evidently I had the src blank while working on it, and since the iframe's id hadn't changed it was still using src="" even though I'd actually put something in the src.
I now change the iframe's id dynamically on each page load:
(PHP) <? $timestamp=time(); ?>
(HTML) <iframe id="photo_<?=$timestamp?>" [...] >
So the iframe's id ends up looking something like "photo_1278123687".
So, good thinking, Apple! Asinine, but there you go. Use "photo_frame" with impunity! (I assume, I didn't actually go back and try it... ;)