This simple code doesn't work on a Facebook page. This code only alerts when I refresh the page. If I go to that page from my Facebook profile, with my mouse; The script stops working.
There are no alerts or errors. :(
It looks like the whole script doesn't work until I refresh.
// ==UserScript==
// @name Purge My Facebook
// @namespace http://www.arda.com
// @description test
// @include https://*.facebook.com*
// @include http://*.facebook.com*
// @version 1
// ==/UserScript==
window.setTimeout (isParent, 500);
function isParent () {
if (window.self == window.top) {
alert ("main window");
} else
window.setTimeout (isParent, 500);
}
I also tried this, among other things:
// ==UserScript==
// @name Purge My Facebook
// @namespace http://www.arda.com
// @description test
// @include http://www.facebook.com/*/allactivity*
// @include https://www.facebook.com/*/allactivity*
// @version 1
// ==/UserScript==
try{
if (window.self == window.top)
alert(document.domain+"\nmain window");
else
alert(document.domain+"\nin a iframe");
}
catch(e){
alert(document.domain+"\nHad a problem:\n"+e);
}