Now, I like this technique for a couple of reasons. I often middle-click to open links in a new tab, and most AJAX systems would either not function or only show the partial render. This system opens the link normally on a middle click, but opens it with AJAX on a normal click.
The problem I’m having is with how the CSS and JS is tailored for the page which was opened initially, and doesn’t load any more if the page changes. I thus have two solutions I can see:
[list=1][*]Attach all the CSS and JS I could possibly need when the page first loads.
[*]Attach the CSS and JS required for each ajax load to that page.[/list]
Now, I like 1 as it’s a: simpler and b: decreases the load of subsequent ajax requests. I’m unsure exactly how to ensure Yii attaches the desired CSS and JS for each render, however.
Is the problem is what you are thinking about to make the solution better or are you dealing with the bug. I think if you choose to do failsafe for middle-click then the required CSS/JS has to be loaded with the page.
You may also want to have a look at CHttpRequest’s getIsAjaxRequest() so you can remove &ajaxView=1.