refresh an iframe without flickering - php

I need it so badly I have been trying it from 3 days but still i cant go for it. The question is how do i refresh an iframe without refreshing entire page for every 2 seconds? I googled so many sites but none helped, All of the codes that I found ,they just flicker the browser window and I dont want it to be happened
some of the sites i googled and more
http://www.codingforums.com/showthread.php?t=168589
http://roshanbh.com.np/2008/09/free-ajax-chat-applications-php.html
but still im unable to get it can anyone kindly explain me with a sample code please?
update
I want an iframe because I want to write users message to an html file using php file concepts and also then display the html file to users by using it as an iframe, for every 2 seconds, So that it looks like chat box.
This was my idea about creating a chat box. I have choose an iframe because i wanted to use smileys in my chat box.Kindly try to help me.Thanks!

Instead of using the iframe as a chat box, you can have the iframe be invisible and have the javascript on the page check the contents of the iframe (hopefully it's the same domain, to make things simple) and update a container on the page itself. Since the page doesn't need to reload, there won't be any flicker.

Related

Loading more images when reached bottom

I want to load more images in my website when I reach the bottom of my page. I'm using php and postgresql as my database.
For this post I simply load some text instead of image. I can write the code for it's equivalent.
So currently, I'm using a button at the bottom of my page, which when pressed re-loads the page and gives you more images(I'm displaying 50 images at a time).
But there are 2 problems with it, one being that the user will have to press the button again and again while I want it to happen automatically.
And the second one being that when new images are loaded, the previous ones are gone. I don't want to happen. For eg., if currently 1-50 images are present, my page later changes it to 51-100 while I want it to have all 1-100. I'm unable to solve this.
Please help. Thanks!
What you are looking for is commonly referred to as "infinite scroll pagination", while what you're asking for is techniclly possible using only PHP it would be a terrible user experience, as each reload would take the user to the top, and they would constantly have to continuously scroll further and further just to reach the location they were previously at.
Alternatively, handle this with JavaScript, an example: https://infinite-scroll.com/demo/full-page.
Doing simple Google searches reveals a plethora of options for JavaScript and JQuery plugins to achieve this.
An alternative, without the need for a plugin you can implement the answer to this:infinite-scroll jquery plugin
Simply call your PHP code in the form of an AJAX request when the bottom of the page is reached and append your new results. (this could be easily achieved with vanilla javascript as well).
Hope this helps.

Cookies in Iframe page loaded with Curl

On http://aegon.nl you'll get an opt-in which only displays when you haven't got the right cookie set for the website.
Now I'm trying to load the website in an Iframe with an injected file (to do some fancy stuff with javaScript). To be able to do that, I need to CURL the sourcecode and change the base href to "aegon.nl" in order to show the same layout (for the url's to the stylesheets and such).
Now, been there and done that. But now I've got a problem with the cookies. I can click the button in the opt-in as many times as I want, but It keeps coming back. I only have this problem after CURLing the content and changing the base href.
After searching the sourcecode I think I found the problem:
var dom=(window.location.hostname.indexOf(".")>0)?'aegon.nl':window.location.hostname;
var AEGONCookieSettings = new AEGON.CookieOptIn(dom)
Probably the problem is solved by changing this part of sourcecode.... But that doesn't solve the problem for the other websites which are using the same kind of opt-in.
Does anyone have a solution for this?

How do I find out that a link was seen

I'm trying to make a page with some links and when somebody clicks on a link, the score count will go up.
How can I find out the visitor who has really seen the page related to link? But not just click the link and close the page for score...
really seen means: page loads completed.
and my links opens in new window.
any solution?
You cant really see pages that aren't in the same domain. Chrome even puts them in a separate thread.
Back in the day you could have used a CSS exploit talked about here: https://developer.mozilla.org/en-US/docs/Web/CSS/Privacy_and_the_:visited_selector
If you really want to make a page with this kind of functionality you will have to make a browser plugin/extension.
You can include a nonce token in the link, and post that token to the server, render the page embedding that same token in some javascript and have the javascript post back the token when the page is done rendering. Seems kinda overkill though.
The only thing I could thing of is maybe make the link to like a redirect page on your site and then you could control to see if the page was loaded and then like after the page was loaded redirect to the actual webpage to link is intended. This way you know for sure that the user waited to view the webpage.
Other than that I don't think there is any other way for you to go about this.

Hide Javascript file from Analytics

I apologize ahead of time for the non descriptive title, as I wasn't really sure how to word this.
I've currently switched some of my Wordpress sites that have a responsive design that implement a slider over to WooSlider. Works super well, and I love it. However, there is something stopping me from switching all of my sites over. And I understand this is not a WooSlider only fault, but it's something I cannot Google and find out.
This is happening on every page view, even those without a slider.
In Google Analytics it shows domain.com/?wooslider-javascript=load&t=1352743207&ver=1.0.0 as a page view. For every single page. I obviously don't want this, but I don't know how to get rid of it.
Another example of this happening is using Gravity Forms with a referrer info plugin that shows page views, search query, browser, etc.
When the form is sent, the following is sent via email.
Page visited 1: domain.com/?wooslider-javascript=load&t=1352743207&ver=1.0.0 (http://domain.com/?wooslider-javascript=load&t=1352743207&ver=1.0.0)
Page visited 2: domain.com/about (http://domain.com/contact/about/
Page visited 3: domain.com/?wooslider-javascript=load&t=1352751787&ver=1.0.0 (http://domain.com/?wooslider-javascript=load&t=1352751787&ver=1.0.0)
Page visited 4: domain.com/contact/ (http://domain.com/contact/)
So obviously I don't want that js file to show up as a page view. How can I remedy this?
Thanks!
Google Analytics Configuration Mistake #2: Query String Variables
wooslider-javascript,t,ver

How can I use the Jquery fadein/fadeout without reloading the page?

I need to create a website with an audio player that plays as users traverse through the site. At the same time, the content section needs to fade out and back in while this is still going on. So bring in another piece of HTML without reloading the page. The question I have is, how can i get all those to run correctly, while at the same time, running different Jquery plugins on different pages?
Essentially, I need to website to run like this one but with a continuous audio player in the corner or something.
http://www.chalicerecording.com/
If you notice, the page never reloads and the name of the actual file doesnt display on the browser top. This gives me the idea thats its using PHP for the page.
So with that idea, I ended up finding this.
http://www.youtube.com/watch?v=ytKc0QsVRY4
The problem im having with that is that I cant seem to figure out a way to run individual Jquery plugins on each individual PHP page without reloading the entire page. I hope this is enough info for you guys to work with.
you will need to use ajax calls to do so
jQuery.ajax
jQuery.post
jQuery.get
you also need to use jQuery fadeIn , jQuery fadeOut

Categories