You can easily check whether the page you're on is in a frameset by comparing the top and self properties like so:
Works in all major browsers.
if (top !== self){ alert('frames') }else{ alert('no frames') }