Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Change page title with PJAX?

Tags:

html

cakephp

pjax

I'm using PJAX with cakePHP. Everything works super fine, but since I'm not reloading the layout, I don't get title update. I was told I had to put a tag in the body, and that it would get removed. It seems to work but, is it valid to have an HTML page without a tag ?

EDIT : well actually the tag isn't removed, so HTML markup is invalid! What is the best practice for this? It would need to be the same for metas.

The official demo uses this in Ruby but I don't read it :

https://github.com/defunkt/jquery-pjax/blob/heroku/app/pjax.rb

https://github.com/defunkt/jquery-pjax/blob/heroku/app/views/layout.erb

like image 972
Ziplo Avatar asked Oct 14 '25 07:10

Ziplo


1 Answers

Since #57 pjax also looks for a data attribute data-title in the fragment that is loaded and should update the main title.

This is much cleaner and would not break html with a title in the body.

like image 124
mahatmanich Avatar answered Oct 16 '25 23:10

mahatmanich