Forcing Google Adsense to load after actual webpage? - php

On my site, I have google adsense in my right hand side nav bar. The problem I find is because the adsence code is placed before the actual webpage content, as I use includes in php to pull my site template in, I find that it loads the adsence code first and can cause everything else to load after it.
Does anyone know of a good way that I can force it to loads after the actual webpage loads?

Hi i managed to solve it. I found this: How to make Google Adsense load last after the rest of page and someone replied with a link to show how to do it. Solved. Thanks :)

http://www.plus2net.com/php_tutorial/sleep.php
Something like this?
Or use a javascript settimeout and display an ajax loader gif whilst it loads.
More info on AJAX preloaders: http://blog.twostepmedia.co.uk/jquery-ajax-gif-preloader/

If you can edit your site's template, then you should be able to edit the Adsense loader. Find where it is being included on your template and move it down, to just before the closing </body> tag.

Related

Page Jumping Error from HTML to PHP - Site coded in tables?

I am working on a site that was previously developed by someone else.
You can see the site here: http://www.pivotalevents.com/nonametag/index.html
Having issue on this page here: http://www.pivotalevents.com/nonametag/introduce.php
I have coded in a CAPTCHA on the contact page and used some PHP, making the page a PHP extension file 'introduce.php'. Previously it was 'introduce.html'.
The problem: When going from any page on the site, to the contact page, the entire contact page jumps around. The page expands, then collapses back to it's normal width. If you look at the logo, you can see it jump out, then back in.
When I change the page back to .html extension, it doesn't do this.
Why is this happening? Is it because the site's main wrapper is a table?
Any direction would be greatly appreciated! :)
Yes this could be because the site's main wrapper is in a table...
I re-wrapped the site in div tags and now the page does not jump. Seems there was a problem related to the tables and switching from HTML to PHP.

Facebook Plugins wont work with ajax

I have a blog page that uses ajax to call different article from PHP files once the relevant link is clicked. The problem is that when the PHP loads the Facebook plug-ins don't work. If I open the PHP files using the URL directly in the address bar on the browser then they work fine. I am including links to my page so that you can see it in action. If you replace blog.html with blog1.php you will see what I mean. I would really appreciate any help. Thanks. http://www.tagwebsites.com.au/blog.html
I managed to sort this out with the help of Facebook. The issue was as simple as adding the BFML tag to the html tag at the top of each page. It works great now. Thank you to everyone that sent messages through. I really appreciate your help.

Google Analytics - Can I put script in footer?

I want to add google analytics to our website and have read some conflicting info about where to put the script tag.
Google says to put it before the closing </ head> tag: http://code.google.com/apis/analytics/docs/tracking/asyncTracking.html
The way our site is designed, this would mean making an edit to every page. It's not that big of a deal if I need to do this, however, our site also uses header and footer include files.
These header & footer files have html code in them and fall just inside the <body> and </body> tags once the page is loaded.
It would be so much easier to just add the script to the header or the footer file. I'd just paste it in there once and it would be serving up the code on every page.
My question is: Can I do this? Can I move the script snippet inside footer include file even though it's not before the </head> tag as google suggests?
Am I asking for problems if i do it this way?
Thanks!!
You can.
The only difference is that if you put in the "footer" (i.e. just before the </body> tag), the browser will first load the DOM (i.e. everything up to the script tag) and then start to load the script. If you put it in the header, it will try to load the script either before it loads the rest of the DOM or while it is loading it (depending on the browser).
You might feel a difference only if you have a huge page with a lot of elements, but the only difference really would be that the script would be loaded later, so if someone aborts a load of the page, the script might not get executed.
Thus, Google recommends to place it in the <head> and if you can, you should, however you also can put it somewhere else if that makes life easier.
I would recommend saving the analytics code in a file and including it in your footer or header - Example: . I've recently run into some issues with Firefox and IE regarding the page load and analytics. It loads the page to the point where the analytics code is present and then the page hangs indefinitely. I can refresh the page and it loads fine, but for some reason it's happening and there's very little info out there regarding solutions. So, in my case I've included the code in the Footer or of the page at the bottom. This way, in regards to your site visitors, they'll likely not even notice because the rest of your page will load and once they click on a link it shouldn't hang again.
I'd say you can - but easier than that. Just place it in the footer and check if the Live-tracking finds visitors if it does you have the answer.
It's possible and is in fact the way many plugins do it (especially most WordPress plugins I've seen). In fact, putting all your JS at the end of the html (just before < /body>) is recommended if those are not required during the load of the page.
I have seen people put it pretty much anywhere on the page. You can put script tags anywhere on the page; many prefer to keep them in the <head> tag, while others put them at the bottom to avoid using document.ready. The point is that putting scripts there still works. Therefore, I see no problem in putting it at the bottom of the page.
Yes, I believe that it would work - it's not recommended though.
f you have a header and footer file, why not just append your Analytics code to it? Unless every page has unique footer/header page, of course. Then I'd recommend you to take a look at MVC.
Observations have already been made here regarding the scripts placement which can be taken on a site by site basis. We run Google Analytics using Google Tag Manager and use the header code placement in the footer and have no problems with that. Google is currently rolling out Core Web Vitals which places website performance as a must have, and so optimising code delivery is really important. Just wanted to add this here as it was pertinant.

how to open google links inside iframe?

i am trying to open a google search inside an iframe. it was working until recently but something happened.
this can be tested here: http://jsfiddle.net/patrioticcow/xTjyX/
i also added &output=embed at the end of the link, but it looks like it doesn't help.
in chrome i get: Refused to display document because display forbidden by X-Frame-Options.
but it doesn't work in Mozilla also.
any ideas?
thanks
The X-Frame option is a header sent by the webserver of the page you are trying to embed into the iframe. It basically tells the browser not to allow embedding the page in an iframe. Have a look at https://developer.mozilla.org/en/The_X-FRAME-OPTIONS_response_header for a more detailed description.
Obviously Google does not want you to embed it's search results into an iframe.
We are seeing the same problem - this time with google in a standard frame. It was fine a couple of months ago, now it's not working. I think that Google just changed the rules... Not a very open thing to do.
I'd suggest that you run what was in the iframe as a separate child window or new tab - not sure if this will give you the result you wanted.

is there a way to have a iframe not reload the page?

I have a page that opens in a modal on a joomla site. On that page, there is a hyperlink that links to a file on the server. That file opens up a joomla article. What normally happens when I have an a hyperlink on one article that links to another article is that only the content of the article displays in the modal, not the framework. But since I have the hyperlink forwarding to the file with the iframe, when it shows that article in the modal, it show the framework. Is there away to have the article show only the content, and not the framework while still having the iframe? I hope this question makes sense. You can see what i am talking about on this link, click on game template:
http://zaazoo.thewebbusters.com/index.php?option=com_content&view=category&id=1&Itemid=2
if you go to this link, and click on round 1, and then hit continue, you would see how the articles display only the content and not the frame work.
http://zaazoo.thewebbusters.com/index.php?option=com_content&view=category&id=8&Itemid=4
any help would be much appreciated.
Thank you,
Dave
If you want to show just the article you can add &tmpl=component to the URL you are trying to display.
this might not be the best solution but i would recommend using a PhP include like :
<?php include("your-post.html"); ?>
Since joomla is php based this should work, and unlike iframes includes will take the theme of the site or modal.
Hope this Helps :)

Categories