Anonymous 0
<html>

<head><title>hopefully this won't be displayed</title></head>
<body><iframe style="border:0" src="http://example.com/" width="100%" height="100%" />
</body>
</html>

Now, lets say that I open up this page in my browser. How can I make it so that my browser's title-bar displays the contents of the element of http://example.com/ instead of the element of my document that I have here?

2 answers

0
points

Ideally you would find a solution which doesn't require an iframe (what are you serving to people who have them disabled?).

If the iframe is from the same domain as the parent, you might be able to manipulate the title of the parent via a javascript (caveat: Some browsers allow the user to disable manipulation of the window title, thanks to past use of annoying scripts which animate the title). Sorry, my javascript-fu is inadequate to tell you how.

If the iframe is not from the same domain as the parent, any decent browser should block manipulation of the parent's title because it would represent a cross-site scripting exploit.

Answered over 7 years ago by Richard Grevers
elena 56
0
points

I think that this would usually be done using some form dynamic (automated) system - in this case if you have a system that is automagically "fetching" the iframe src then it would be able to fetch the header from http://example.com also as a separate variable.

Otherwise you would be coding in the src by hand anyway and so it wouldn't seem like a difficult leap to hand-code the title also.

Correct me if I'm wrong but the following code is completely dysfunctional:

<title><iframe ... / ></title>

Is you example dynamic or are you putting in the content details by hand?

Answered over 7 years ago by elena