I am trying to get the width of the page in an iframe (on the same domain) using the following:

but it seems not to be working. The iframe width is a constant but I want to get the page width based on whether there is a scrollbar or not. If there is not scrollbar, the code should give the fixed iframe width, if there is a scrollbar (which means the page content height is greater than iframe height), the code should give fixed iframe width minus 17 (scrollbar width).

Any ideas how to do that?