Jump to content

iframe as a page


es131245

Recommended Posts

The idea is to load "full" page only once.

As a full page I meen title bar, navigation, content and footer.

After loading jquery will update links to adding get parameter that will tell php to load "content" only.

<?php if(isset($_GET)&&isset($_GET['ajax']))getContent('pages.html');?><!DOCTYPE html><html lang="en"> <head>  // HEADINGS </head> <body>  // HEADER  // NAVIGATION  <iframe src="pages.html"></iframe>  // FOOTER </body></html>

The question is how to evade scrollbar of a iframe? Scrollbar of a body is the only allowed.

Edited by es131245
Link to comment
Share on other sites

I sent you a message before I had postng privelages. Here's that message again in case it helps:

 

In CSS, overflow:hidden should work... but it will clip any content that doesn't fit in your iframe so you would need to make sure your iframe is big enough. Otherwise there are iframe properties that you could add in the html - scrolling="no"frameborder="0".Overflow:hidden should cover it, but if it doesn't work in all browsers, adding the scrolling="no" property to your html will cover the cases where the css solution doesn't work.

Link to comment
Share on other sites

The only solution that i could think of.

<!DOCTYPE html><html lang="en"> <head>  // HEADINGS </head> <body>  // HEADER  // NAVIGATION <div></div>  <iframe src="pages.html" style="display:none;" onload="copyContentFromIframeToDiv();"></iframe>  // FOOTER </body></html>
Link to comment
Share on other sites

You can use AJAX to load page content rather than an iframe.

 

I would recommend using a server-side language, though, so that search engines can remember the page and so that each page has a unique URL that the user can use to get back to it.

Link to comment
Share on other sites

You can use AJAX to load page content rather than an iframe.

 

I'm using it at the moment

function page(url,link){$('html').append('<img src="/source/images/progress.gif" />'); $('img[src="/source/images/progress.gif"]').css({borderRadius:'15px',boxShadow:'0 0 15px blue',height:'48px',left:'50%',marginLeft:'-150px',marginTop:'-24px',opacity:0,position:'fixed',top:'50%',width:'300px'}); $('html').animate({scrollTop:$('body').offset().top},350); $('img[src="/source/images/progress.gif"]').fadeTo(500,1); $('body').fadeTo(500,.15,function() {$.ajax(((url.indexOf('?')==-1)?(url+'?ajax'):(url+'&ajax')))  .done(function(data)  {var html=$('body').html().substr(0,$('body').html().indexOf('n  </ul>')+8)+"n"+data+'  <a>'+$('body>a:last-of-type').html()+'</a>';   $('body').empty().append(html);})  .fail(function()  {var html=$('body').html().substr(0,$('body').html().indexOf('n  </ul>')+8)+"n"+'<h2>Error 404</h2>n        <h3>File not found</h3>'+"n"+'  <a>'+$('body>a:last-of-type').html()+'</a>';   $('body').empty().append(html);})  .always(function()  {tools();   links(link);   $('body').fadeTo(300,1);   $('img[src="/images/progress.gif"]').fadeTo(300,0,function()    {$('img[src="/images/progress.gif"]').remove();});     $('body>ul:first-of-type>li:last-of-type>ul>li').stop().slideUp(200,function(){$('body>ul:first-of-type>li:last-of-type>ul').css({marginTop:'-10px'});});});});}function links(from){$('a').each(function() {if(typeof($(this).attr('href'))!='undefined'&&$(this).attr('href').substr(0,1)=='#')  {$(this).unbind('click').click(function()   {$('html,body').animate({scrollTop: $($(this).attr('href')).offset().top},'slow');    return false;});}  else if(typeof($(this).attr('href'))!='undefined'&&$(this).attr('href').indexOf(':')==-1&&$(this).attr('href').indexOf('.')==-1)  {$(this).unbind('click').click(function()   {$(this).css({'textDecoration':'underline'});    page($(this).attr('href'),$(this));    return false;});}});}$(document).ready(function(){links();});

It has a problem. Then I serfing site the content if fine but url path does not change at all.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...