How to get IFRAME <head><title>header title</title><head>... not <iframe title="" >

Hi ,
i am new to this sphere and need some help from any experts .
so the story is that i using and IFRAME in my web site , and i want the main title of the document (which appears in the browser title bar) to be the title from the iframe ‘page’ . my English is not so good so i 'll give an example .
main.html page :
<head> <title> browser title <title><head>
<body> … what ever …
<iframe title=“tag_title” id=“content_iframe” name=“cnt_iframe” src=“ref.html” width=843 height=800 …></IFRAME>
</body>

ref.html page:
<head> <title> this title WANTED to be the main <title><head>
<body>

i search for an answer but only got the option to set the title to the IFRAME TAG TITLE by javascript
document.title = document.getElementById(content_iframe).title ;

maybe the correct answer to the question is :
document.title = document.getElementById(content_iframe).document.title ;

but for some reason it is not working .

Please HELP !
THANKS A LOT

quote a string in document.getElementById
var I=document.getElementById(‘content_iframe’);

Get a reference to the iframe document.
It varies between browsers, and you can only read these values if the iframe src is from the same domain as the page that contains it.

var doc2= I.contentWindow? I.contentWindow.document || I.contentDocument;
if(!doc2 && window.frames[‘content_iframe’]) doc2= window.frames[‘content_iframe’].window.document;

if(doc2 && doc2.title) document.title=doc2.title

IT IS GREAT ,
WORKING 100% !!! ( with IE , FF & Chrome )
THANK YOU VERY MUCH !!!