Facebook Iframe Issue - php

I am working on an iframe based Facebook applicaton. I am able to use FB.Canvas.setAutoResize(); to let the iframe "stretch" the page so there's no scroll bar for the iframe. The page may be 2-3 page-length in height. I can scroll down the page using the windows scroll bar. The issue is when I am at the bottom of the page and I click a link inside the frame, the content in the frame loads but I am still at the bottom of the page. Is there a way to set it so that when the link inside the frame is clicked, the outer page will scroll back up to the top of the page so you can see the content of the frame at the top?
Mike

The best solution I've found is to make sure any links below the fold target '_top' and href 'apps.facebook.com/appname/?whatever'. In essense, you're reloading the FB chrome on every click.
This has the added benefit of sending new access_tokens more often.
UPDATE: Facebook announced today that this now works:
FB.Canvas.scrollTo(0,0);

Related

How to get page source that is loaded through AJAX?

I am using data scrapping technique(Parsing) in php to get the data from a web page using html_dom class. This page has some AJAX method to load more data when we scroll down the page but in page source there is only data that loads first time mean when we browse the page first time.
So my question is how to get the all page source that loads through AJAX??
Thanks
If you are using chrome, you could use developer tool or F12 button. Then go to network tab and tick the preserve log button and select the XHR tab to see which source is being loaded in that page.

Autoload a new page at the end of the page

Is there a way to autoload a new page when the user reaches the bottom of a page?
eg: a user is browsing a.php When the user scrolls down to the bottom of the page a.php, the new page, say b.php loads automatically without refreshing the page (the url in the address bar also changes to b.php)
eg this page: http://timesofindia.indiatimes.com/city/shimla/Uttarakhand-dissent-made-Congress-call-HP-meeting/articleshow/51679032.cms
When you scroll to the bottom of the article, the new article is loaded and also the url of page in the address bar changes to the new article's url
It is possible with PHP + jQuery + AJAX but it's not as easy as you might think if you need to care about SEO. Take a look at what Google says about SEO-friendly infinite-scrolling. Take a look at John Muller's demo. More about it in this SO topic.
Plugins that'll help you start:
jScroll
ScrollMagic
Infinite AJAX Scroll (paid)
jQuery Endless Scroll (abandoned)
Infinite Scroll (abandoned)
PS. Remember that Infinite Scrolling is NOT for every website!

How to make my jquery plugin not restart when pressing links in my dynamic php website?

I have a classic php controller that gets the page name from the url and displays that page under my header section where my slideshow lives.Every time a press a link the slideshow restarts from the fisrt photo again or its killed while sliding and image.I know that the cause of that is that everytime time a link is given to the browser all the page is beeing proccesed again .
I know a few ways to go arround the problem using Ajax but the only problem with that is that the url will not change because it will be Async..I want to keep my url so my visitors are able to share the links they want.
An example site is at http://sounds.beatport.com where you press a sample to play , it loads it at the top and then you can browse thru the styles drop down menu changing links but yet the sample keeps playing..
So what i want to achive is having a div with my slideshow plugin keep playing at the top of my site without restarting while the visitors browse thru the site;

Load advert on click

So, I have a HTML page with links to video files on my server. What I need is, when someone clicks on the video links, a script should start loading up the advert from Google Adsense.
And after 10 seconds, it should be automatically redirected to the video file.
How can I do this?
Thanks
I'm sure that goes against the crazy adsense TOS. Read them again before getting banned.
Isn't that illegal?
You need to change the link to the video with a simple text (in ) and add
the "onClick" attribute which will activate a JS function.
<div onClick="javascript:showAdvertAndRedirect('http://www.video.com/id/23233')">Click to see the video</div>
The js function will show the ad (by changing another div's innerHTML)
and will also run a timer of 10 seconds (actually a delay) , eventually will redirect
the visitor to the mentioned url.

Auto scroll down iframe

How can I get an iframe such that when it loads up, it loads up with the page inside scrolled down by a fixed amount (say 100px)?
I have so far:
<iframe src="http://news.bbc.co.uk/1/hi/uk/7459669.stm" scrolling="no" width=500px height=500px></iframe>
but it loads up with the bbc.co.uk page inside at the top left when I actually want it to load up scrolled part way down (that is the page inside the iframe scrolled down, not the page containing the iframe).
Anyone know how to do this?
Its not exactly what you are looking for but you could set the URL to load scrolled to a particular element if you know that an element with that ID will always be on the page.
Something like this:
http://news.bbc.co.uk/2/hi/uk_news/7459669.stm#mediaAsset
HTH
You can not do this. Browser security restrictions will prevent you from accessing the "inside" of that frame completely. If the frame src was from the same domain as the containing page, then you could add an onload handler that set myiframe.contentDocument.body.scrollTop = 100;.
Genrally I Do Specify marginheight attribute on iframe for this
<iframe src='url' marginheight='100px'>
You can also use marginwidth attribute to move inner page left side
for more information checkout this link
http://www.w3schools.com/tags/tag_iframe.asp
I hope Thats Help

Categories