In which I have a fight with Firefox and almost lose

posted in: Natter, Webbish Workings | 0

If you are (perhaps wisely) not a webgeek, you can ignore this. Or read the note at the end.


So I learned today that Firefox has this security thing about iframes and their sources.The gist is, when the iframes go to the same domain, (preferably the one where your page already is), life is copacetic. If you (like me) want to embed content from two different domains (say, google calendar and an indiegogo project), it looks like it’s going to be easy. Both sites have this simple “embed this” feature: you click an embed button, it gives you a bit of code, you add that to your own page’s code, and it all works well.

Well, if you are using Opera. Or Chrome. Not so, Firefox! (I usually save testing IE and Safari and mobile ’til the easy three are sorted).***

And for whatever reason, although I could easily find both jQuery and javascript solutions, I (embarrassingly) could not make them work.

But lo! I am not blathering on just to tell you my failings! I came across a tiny reference to essentially making fake-frame pages. I hope you never need to know this or you have better solutions and they all take you less time. But it goes likes this:

On the page with two frames, I sourced two files on the same domain as the one that wanted to show them:

<iframe src="file1.html"></iframe>
<iframe src=file2.html"></iframe>

Then in file1.html I used the provided code from clicking those embed buttons (in a regular HTML5 page with as little stuff in head and body as I could manage):

<iframe src="src="https://www.google.com/calendar/embed?show..."></iframe>

and in file2:

<iframe src="http://www.indiegogo.com/project/monkton-road-wildlife-crossing/widget"></iframe>

Plus the usual styling and whatnot both within file1 and file2, and on the original page. Which one leaves as an exercise for the reader.

This is clearly slower than scripts. And someday, when I have more time, I hope to revisit this and do it much more elegantly.


* For those my readers who are perhaps wisely not webgeeks, some web pages have blocks (inline frames subwindows, or iframes) in which some or all of other web pages are shown You see these _all_ the time in one way or another, and when everything is rolling well, you barely notice they are bits of different sites owned, operated,managed and so one by completely different people.

** Popups are like the spices you don’t like. Very occasionally they can be used sparingly to nice effect.

*** Safari was fine. IE had its own issues. This particular client site just will never bee great on mobile until they get a grant to redo the whole architecture from the ground up…

Leave a Reply