I’m having some issues with the following function inside of https://github.com/browserstate/ajaxify
For a url that is in the following form:
http://rooturl.com/?alfa=a
or any other query string is not being recognized as internal link. (Where rooturl.com is my internal homepage)
// Internal Helper
$.expr[':'].internal = function(obj, index, meta, stack){
// Prepare
var
$this = $(obj),
url = $this.attr('href')||'',
isInternalLink;
// Check link
isInternalLink = url.substring(0,rootUrl.length) === rootUrl || url.indexOf(':') === -1;
// Ignore or Keep
return isInternalLink;
};
How can I modify this function to make it count internal URLs with query strings as ‘internal links’??
for reference that function is used in the following context:
$this.find('a:internal:not(.no-ajaxy, .no-ajaxy a)').click(function(event){
// so on...
});
I think all you need to do is check for the ? in the URL as it is required for query strings
But another URL might have query string and be external so you might need to use split() and check that the first bit matches the rootUrl