// if this code is inside iframe
var topWindow = window.top;
// then object topWindow.document is not accessible
topWindow.document.getElementById("iframe_id")); // doesn't work
// if this code is inside iframe
var topWindow = window.top;
// then object topWindow.document is not accessible
topWindow.document.getElementById("iframe_id")); // doesn't work
Are both the top window document and the page with the script on the same domain? You can't access content in a frame unless they are on the same domain.
This has actually been discussed in quite a bit of detail here. http://stackoverflow.com/questions/958997/frame-buster-buster-buster-code-needed/