Answer the question
In order to leave comments, you need to log in
Opening Ajax windows with a script?
Hello!
There is a client site-one-page on Joomla! The problem with it is that all additional materials (pages) open in Ajax windows, and when you go to these opening pages from search engines, they are shown in a simplified template. Now there is a task so that when entering such a page, the user is redirected to the main page and this material is opened to him in the Ajax window. The windowing mechanism is implemented through the RokBox plugin ( demo ).
Links look like:
<a href="/extensions/images/stories/demo/rokbox/rs8.jpg"<br/>
rel="rokbox[561 350]"<br/>
title="Audi RS8 :: Sample Caption for RS8"><br/>
Answer the question
In order to leave comments, you need to log in
On the main page, go through all such links and add some parameter to them:
$(function() {
$('a[rel^="rokbox"]').each(function(){
if (this.href.indexOf('?') == -1) {
this.href = this.href + '?ajax=1';
} else {
this.href = this.href + '&ajax=1';
}
});
});
Try checking the X-Requested-With header so you don't have to add a parameter to the URL. I think all JS libraries now add it (standard?)
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question