Start networking and exchanging professional insights

Register now or log in to join your professional community.

Follow

How can I change the url title bar in jquery without reloading the page?

I have textbox <input name="title_bar" type="text" /> any text on this text-box should be appear to URL title bar of the browser I wanna something may worked on IE7

user-image
Question added by Khadijah Shtayat , Technical Lead , Opensooq
Date Posted: 2013/09/11
Ayman Shorman
by Ayman Shorman , Devops Manager , Smart Charging Technologies

Solved,

$(document).ready(function()

                  {

 

                    $('#textBox').bind('keypress blur', function()

                                     {

                                       $(document).attr('title',$('#textBox').val());

                                     });

                  });

Enjoy Jquery :)

Khadijah Shtayat
by Khadijah Shtayat , Technical Lead , Opensooq

The solution was using 

history.pushState(null, null, $("[name=title_bar]").val());

 

But the problem was : this solution not worked in IEs browser .I need more general solution.  Can I get  help?

Mohamed Alabbas Mustafa
by Mohamed Alabbas Mustafa , Technician , OCSHI

$("title").text("New Title");

$(function(){

            var YOUR_PATH = "/foo.html";

            $("#txtBox").change(function(){

                document.title = this.value;

                try {

                    history.pushState(null, "", YOUR_PATH);

                }catch (e){ 

                   window.location.hash = YOUR_PATH;

                } 

           });

        });

$(document).ready(function(){

     $('#tbID').keyUp(function(){

     if($('#tbID').val()!='')

          {

              $(document).attr('title',$('#tbID').val());

         }

     })

})

Give your Input an ID, let's say ("txtTitle")....

u do the following....

var The_Title=$("#txtTitle").val();

$("title").text(The_Title);

give the id to text box like,

 

<input  id ="title_bar" name="title_bar" type="text" />

In jquery,

textValue = $( "#title_bar" ).val(); 

document.title = textValue;

More Questions Like This

Do you need help in adding the right keywords to your CV? Let our CV writing experts help you.