HTML Logo by World Wide Web Consortium (www.w3.org). Click to learn more about our commitment to accessibility and standards.

Moving forward with Composr

ocPortal has been relaunched as Composr CMS, which is now in beta. ocPortal 9 will be superseded by Composr 10.

Head over to compo.sr for our new site, and to our migration roadmap. Existing ocPortal member accounts have been mirrored.


Opinion sought regarding frames

Login / Search

 [ Join | More ]
 Add topic 
Posted
Item has a rating of 5 (Liked by Robbie Goacher)  
Rating:
#89508 (In Topic #18091)
Avatar

Up to this point we have used iframes in ocPortal for handling self-contained sections of a page.

For example, if you vote in a site poll, it submits into its own frame and updates, so that the whole page does not need refreshing.

Unlike other projects we have used iframes for web standards reasons. They are the official way to represent a subpage and they don't depend on Javascript.

However things have changed since then. ARIA has come out (which allows marking up of what dynamics on a page involve), XMLHttpRequest has become a proper web standard, mobile devices have gone from having poor JS-handling to being extremely Javascript heavily, and generally screenreader users are comfortable with Javascript.

Frames are rather tangential to other technologies for dynamic page updates, i.e. if we continue to use frames we essentially have to do stuff in two ways going ahead. Frames are also a pain for styling, don't look great when refreshing, and aren't great for search engines.

We're currently considering how AJAX will work in future versions, and I want to do it as neatly as possible. I wanted to know if anyone has any views on scrapping frames and replacing it with AJAX. We would continue to support non-JS users via full page reloads.

I'd welcome thoughts from people, visually-impaired or not. It hurts to throw away something we were doing 'right' compared to others that flatly require Javascript, but the world has changed since the decision to use iframes and I don't think there's a reason to use them anymore.


Become a fan of ocPortal on Facebook or add me as a friend. Add me on on Twitter.
Was I helpful?
  • If not, please let us know how we can do better (please try and propose any bigger ideas in such a way that they are fundable and scalable).
  • If so, please let others know about ocPortal whenever you see the opportunity.
  • If my reply is too Vulcan or expressed too much in business-strategy terms, and not particularly personal, I apologise. As a company & project maintainer, time is very limited to me, so usually when I write a reply I try and make it generic advice to all readers. I'm also naturally a joined-up thinker, so I always express my thoughts in combined business and technical terms. I recognise not everyone likes that, don't let my Vulcan-thinking stop you enjoying ocPortal on fun personal projects.
  • If my response can inspire a community tutorial, that's a great way of giving back to the project as a user.
Back to the top
 
Posted
Rating:
#89601
Avatar

Community saint

Another change that would cause me insurmountable problems unless I can figure out how to substitute some other way of running a script - in an iframe -  successfully on my 8.1.3 site.

Brief background: I've used LazarusGB (guestbook software) for years, and each time I've jumped to another CMS container I've always managed to integrate LazarusGB into it successfully, importing all the Guestbook entries spanning centuries (or so it seems). Nothing 'wrong' with the built-in ocPortal Guestbook, but this is my preference.

The integration into ocPortal was surprisingly 'easy' using the following:

Code


[title="1"]Guestbook[/title]


{+START,BOX,Anglo-Indian Portal Guestbook - (Guestbook navigation is confined to this box),100%,curved,}
[html]
<iframe id="lazarusgb" name="lazarusgb" title="lazarusgb" class="autoHeight" src="http://www.tapmal.com/anglo/lazarusgb/index.php" scrolling="auto" marginwidth="0" marginheight="0" frameborder="0" width="100%"></iframe>
[/html]
{+END}


and this JS:

Code


function doIframe(){
   o = document.getElementsByTagName('iframe');
   for(i=0;i<o.length;i++){
      if (/\bautoHeight\b/.test(o[i].className)){
         setHeight(o[i]);
         addEvent(o[i],'load', doIframe);
      }
   }
}

function setHeight(e){
   if (e.Document && e.Document.body.scrollHeight) //ie5+ syntax
   e.height = e.contentWindow.document.body.scrollHeight;

   else if (e.contentDocument && e.contentDocument.body.scrollHeight) //ns6+ & opera syntax
   e.height = e.contentDocument.body.scrollHeight + 35;

   else (e.contentDocument && e.contentDocument.body.offsetHeight) //standards compliant syntax - ie8
   e.height = e.contentDocument.body.offsetHeight + 35;
}



function addEvent(obj, evType, fn){
   if(obj.addEventListener)
   {
   obj.addEventListener(evType, fn,false);
   return true;
   } else if (obj.attachEvent){
   var r = obj.attachEvent("on"+evType, fn);
   return r;
   } else {
   return false;
   }
}

if (document.getElementById && document.createTextNode){
 addEvent(window,'load', doIframe);   
}


Which gets me this display …



Administration is performed 'outside' the iframe in a new tab or window, and when the task is complete, clicking on 'close admin' …



… I am taken to a new window that simply says …



Closing the tab or window returns me to my Guestbook page.

For me, this set-up is simple and elegant, and achieves a well-defined and recognizable Guestbook. More, it has also managed to retain the Guestbook entries from over the years.

How, I wonder, will I be able to continue displaying my choice of Guestbook if the ability to use an iframe is discontinued?

 O_o

Take my advice. I'm not using it!

View my working ocPortal site (version 9.x.x) at Anglo-Indian Portal
Back to the top
 
Posted
Rating:
#89604
Avatar

I'm not a programming genius like Chris is, but I don't think there's any suggestion of us preventing people from using iframes for custom scripts. Chris is just suggesting that ocPortal itself phase out its own iframes.


Like ocPortal on Facebook:
Back to the top
 
Posted
Item has a rating of 5 (Liked by Robbie Goacher)  
Rating:
#89605
Avatar

Community saint

Gotcha, Robbie!

I re-read the post, and I suspect I read too much into Chris' closing sentence!

 :thumbs:

Take my advice. I'm not using it!

View my working ocPortal site (version 9.x.x) at Anglo-Indian Portal
Back to the top
 
Posted
Rating:
#89608
Avatar

Community saint

Chris Graham said

Frames are also a pain for styling, don't look great when refreshing, and aren't great for search engines.
Exactly. iframes, while useful, can be a real pain to cleanly incorporate into a rich site.

Fletch said

Another change that would cause me insurmountable problems unless I can figure out how to substitute some other way of running a script - in an iframe -  successfully on my 8.1.3 site.
Robbie's interpretation is correct, Chris just want to eliminate iframes from the official product.

There will be nothing stopping anyone from adding iframes they want/need for themselves.

Do you have a Samsung Galaxy S / Galaxy S II ? If so, why not check out my ScreenFree FM Radio .
Back to the top
 
Posted
Rating:
#89942
Avatar

Community saint

I like the idea of dropping frames for Ajax!
Back to the top
 
Posted
Rating:
#89947
Avatar

Community saint

Time and technology move forward. It seems that AJAX is the modern solution to what was previously done with frames. Keeping ocPortal current with technologies will be important over the long haul, so I think this is a good idea.

Bob
Back to the top
 
1 guests and 0 members have just viewed this: None
Control functions:

Quick reply   Contract

Your name:
Your message: