Posted in JavaScript, JavaScript - native, Mobile Development, Snippets, Web Development

View Leadboltads.net source code on an Android device.

Leadbolt does everything humanly possible to hide their code from you. But not today my friends. I made it my mission to hack it so that I could enforce my own styles against the content.

If you are developing an android HTML5 app, simply place the JavaScript code I am about to give you below as the last thing before the closing body tag, and the Leadbolt ad code will be expose.

<script>
    alert(document.getElementsByTagName('html')[0].innerHTML);
</script>

Run your code directly in any android browser. This will launch a JavaScript popup within your android application that reveals the rendered HTML tag source code.

Have fun, I’m sure this might work with all types of JavaScript based ad services for android devices.

Posted in Coldfusion, JavaScript, JavaScript - native, Snippets, Web Development

Escape an iFrame after a session logs out

Here is an example of how I escape an iFrame when my log in page is loaded.

So let me set the stage first.

I have an app that uses iFrames (very old app that I didn’t build). In my ColdFusion Application.cfc I tell the app to force the log in screen once a session has expired. So to avoid the iFrame from loading the log in screen my task is to tell the log in screen to check if it’s within an iFrame. If the page is within an iFrame I want the parent page to reload. By default my iFrames will be gone and the parent page will fail the session check. Hence forcing the parent page to display the log in as anticipated.

Place the following code on your log in screen or whatever screen you wish to have escape the iFrame.

<script>
    var iFramed= (window.location != window.parent.location) ? true : false;
    if(iFramed == true){
        alert('Your Session has expired. Please log in again.');
        window.parent.location.href = "index.cfm";
    }
 </script>

The target file to load into the parent window is in my case index.cfm. Your can of course point to any target you wish. Perhaps login.cfm or what ever suits.