Is there a way, using jQuery, to change the document.title after the page has loaded?

前端 未结 5 1200
半阙折子戏
半阙折子戏 2020-12-18 13:00

I have coded myself into a corner. Does anyone know the answer? Thanks!

相关标签:
5条回答
  • 2020-12-18 13:22

    Maybe this will help you:

    $(document).attr('title', 'new title');
    
    0 讨论(0)
  • 2020-12-18 13:23

    Try:

    $(document).ready(function() {
        this.title = 'foo'
    })
    
    0 讨论(0)
  • 2020-12-18 13:29
    document.title = 'new value';
    

    Is this not working for you?

    0 讨论(0)
  • 2020-12-18 13:42

    $('title').text("Boo"); is not good idea because IE8 has problem with that.
    this bug is reported Here but jQuery developers did not solve that and their solution is Use document.title='Boo';.

    my idea is that

    1. using document.title is best option and it is cross browser solution
    2. but if you are used to use jQuery you can use $(document).attr('title', 'new title');. i tested it and has no problem with major browsers and IE8
    0 讨论(0)
  • 2020-12-18 13:43

    This will work also:

    $('title').text("Boo");
    
    0 讨论(0)
提交回复
热议问题