Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

jQuery ui tabs with base href and query string doesn't work

The jQuery ui tabs is working for me but when I place a query string behind it, it will load in the base href content.

Maybe i'm not understanding the correct behaviour of base href/relative links. But here is my set up:
Base href: http://example.com/ .
Relative link: random/link/example.do.
Hastag like so: #fragment-1 .
Full link: http://example.com/random/link/example#fragment-1

That's how my link looks like. When i put a query string behind it, it will not work. Like so: http://example.com/random/link/example?refresh=2

I found some fixes that adjust the source code. (link). But is there a way to fix this without adjusting the source code?

Thanks

like image 773
user1081577 Avatar asked May 06 '26 09:05

user1081577


1 Answers

Hey it's horrible but you can try this

$(function () {
    var rquery = /\?[^#]*/;
    $("#tabs").find("a").each(function() {
        this.setAttribute("data-orig-href", this.href);
        this.href = this.href.replace( rquery, "" );
    });

    $("#tabs").tabs();
});

Here's a fiddle to show it working.

like image 93
DeMeNteD Avatar answered May 08 '26 23:05

DeMeNteD



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!