Copying AdSense on page using jQuery - is it against AdSense rules? - ajax

I need loading Google Adsense Ads with AJAX. I found, that it's not allowed at this time, so I was thinking and invet this:
I normally include Google javascript code into HTML page in DIV with some ID like:
<div id="google_ad">
<script>
google_ad_client = "ca-pub-XXXXXXXXXXXXXXXXXXXX";
google_ad_slot = "XXXXXXXXXXX";
google_ad_width = 300;
google_ad_height = 250;
</script>
<script src="http://pagead2.googlesyndication.com/pagead/show_ads.js"></script>
</div>
And then, when I'm loading new content via AJAX, I create new DIV with some CLASS and then copy content of into every like this:
$('#content').append($('<div>').load('http://www.foo.com/load.php'), function(){
$('.google_ad').html($('#google_ad').html());
}));
Do you thing that it's ok or it's against Google AdSense rules?
Thank you for your answer.

I am an Adsense publisher since 2006, your ajax trick looks cool. So you mean your full and unaltered Google adsense code is inside the load.php file ?
According to this link (google forum) loading your Adsense code via ajax is same as loading your adsense code via IFRAME.
So to protect your adsense account, put your adsense code naturally.

Related

JQuery mobile disables links and forms

I've made page with sidebar, which can be hidden. I added JQ mobile becouse I need swipe event for handling it on mobile devices, but JQ mobile broke the page completely.
All forms are submitted by AJAX (I found event for forms and links in G Chrome- developers) and all links also tries to load content by AJAX.
Is there any way how to disable it for whole page (some global config, not just with data-ajax=”false” which doesn't work for me at all)?
Could anyone help me fixing that? Thank you :)
After few hours browsing documentation, I've found, what I needed. I just needed to move config code before JQ Mobile script loading.
Now it works;
<script src="files/script/lib/jquery.min.js"></script>
<script type="text/javascript">
$(document).on("mobileinit", function () {
$.extend($.mobile, {autoInitializePage: false});
});
</script>
<script src="files/script/lib/jquery-mobile.min.js"></script>

Using plugin outside of Wordpress pages

I am trying to use lightbox plus plugin for Wordpress which works fine for most of my site.
I have a php page which is used by a jQuery AJAX function to retrieve data in order to paginate a large result set back in wordpress. This page is not part of wordpress.
I have managed to get Wordpress functions to work fine in this php page by using:
define('WP_USE_THEMES', false);
require('/home/love/public_html/dev/wp-blog-header.php');
require('/home/love/public_html/dev/wp-load.php');
However, in this page is an include, and within the included file is a link to an external sheet which is meant to be brought in with a lighbox:
<a class="" rel="lightbox" href="<?php bloginfo('url'); ?>/more-product-info?a=<?php echo $post->ID ?>">
<div id="moreprodinfo">More Info</div>
</a>
This method of retrieving information in a lighbox works ok on most parts of my site, but its just not working on the part that uses AJAX to retrieve the link to the lighbox page.
I assumed it was something to do with plugins not working when the page is not part of Wordpress, but all the Wordpress function have been working so why not plugins? Also my cufon plugin doesnt work on this ajax retrieved page either.
Is it becuase I am using .html javascript function to display the content retrieved by AJAX:
if(pageType == 'prizeHome'){
loading_hide();
$("#tab-prize-home #container").html(msg);
Any help would be appreciated
It looks like a common issue when using ajax to load html content :
You probably call lightbox and cufon when document is ready, which happens only once before your ajax call. You have to call again lightbox and cufon after your ajax call.

Load a page into an iframe with C# ASP.NET, Razor, and MVC3

I want to load an external page (i.e. google or facebook auth) into a iframe when the user clicks a button. How would you do this using MVC3 and Razor?
This seems like an extremely trivial task, but I can’t seem to figure out what to ask Google so I get something back I can use.
You could use JQuery something like this:
<script type="text/javascript">
$(function () {
$('#myButton').click(function () {
$('#myFrame').attr('src', 'http://www.google.com/');
});
});
</script>
<iframe id="myFrame"></iframe>
<button id="myButton">
Refresh IFrame
</button>
However, you will find that some sites (such as google.com) will prevent you from doing this, as they can specify in their response header whether or not the page can be opened in an IFrame. This is to prevent 'clickjacking' and is built in to most modern browsers.

Display share buttons with Ajax. Where to put facebook and twitter scripts?

This is a simple php file that displays a Like and Tweet button.
<? $url = "http://example.com"; $title = "Title";?>
<div id="fb-root"></div><script src="http://connect.facebook.net/en_US/all.js#appId=247886858583094&xfbml=1"></script><fb:like href="<?=$url?>" send="false" layout="button_count" width="80" show_faces="true" font=""></fb:like>
Tweet<script type="text/javascript" src="http://platform.twitter.com/widgets.js"></script>
My problem is basically that I want to get this file to display in my page via Ajax and it doesn't. It works as a standalone page, just doens't load through ajax.
Why doesn't it work and what can I do to make it work?
Facebook :
http://forum.developers.facebook.net/viewtopic.php?id=68635
Twitter :
http://www.ovaistariq.net/447/how-to-dynamically-create-twitters-tweet-button-and-facebooks-like-button/

Facebook dev - loading fbml & html code into a div in an iFrame via Ajax

I've got an iframe application that's working fine and rendering fbml in facebook. But the whole app is built using ajax calls to load large chunks of pages. Several of these have < fb: tags that aren't being rendered when they load. I tried the code below, which is then loaded into a div in my index page, but it doesn't show anything at all, no html, no fb rendering, nothing. Can someone please tell me what I'm missing?? Thanks so much!!
<script src="http://static.ak.connect.facebook.com/js/api_lib/v0.4/FeatureLoader.js.php" type="text/javascript"></script>
<fb:serverfbml style="width: 600px;">
<script type="text/fbml">
<fb:fbml>
<!-- all of my html and my php and my fb tags go in here, for example: -->
<fb:name uid="my_real_user_id" useyou=\"false\"></fb:name>
</fb:fbml>
</script>
</fb:serverfbml>
I hope my question was clear. If not, just let me know I'll explain in more detail! :P
have look at this question
Loading Facebook fb:profile-pic via AJAX in Facebook Connect site

Resources