Reputation: 192
I have a index page with 2 iframes in it. when I click on a link in iframe 2 a page will be opened in iframe 1. Now as an extra I would like to change the browser tab title when you click on that link in iframe2.
I know how to change the browser title tab with the following script but that does only work when it is on the index page.
<script type="text/javascript">
$(document).ready(function(){
$('#link1').click(function(){
$('head title').text('HelloWorld');
});
});
</script>
<a id="link1" href="home.html" target="iframe1">Home</a>
Hope you guys can help.
Upvotes: 2
Views: 8171
Reputation: 11
Perfect Markus! I was able to use your solution in my jquery application, but I used it inside a function because the title can gain two values depending on the value selected in the radio input.
$.fn.relacionamento = function() {
if ($("input[name=f_exclusivo]:checked").val() == 0) {
$('head title', window.parent.document).text('Titulo 01');
} else {
$('head title', window.parent.document).text('Titulo 02');
}
};
$("input[name=f_exclusivo]").click(function(){ $().relacionamento(); });
Upvotes: 0
Reputation: 8268
This should work.
<script type="text/javascript">
$(document).ready(function(){
$('#link1').click(function(){
$('head title', window.parent.document).text('HelloWorld');
});
});
</script>
Home
Upvotes: 9