szakendreszakendre Posts: 24Questions: 10Answers: 0
edited January 2023 in DataTables


I'm using DT 1.11.5, but my problem appears with other versions too.

I want to use URL search and stateSave together.

        $.urlParam = function(name)
            var results = new RegExp('[\\?&]' + name + '=([^&#]*)').exec(window.location.href);

            if (!results)
                return '';
            return results[1] || '';

                "sSearch": $.urlParam('search')

When I turn the stateSave on, the URL search doesn't work with Firefox 109.0 and older versions too, and Chrome 109.

Does anybody have an idea how to solve this, or a workaround maybe?

Thank you and have a nice day!


  • colincolin Posts: 15,226Questions: 1Answers: 2,593

    We're happy to take a look, but as per the forum rules, please link to a test case - a test case that replicates the issue will ensure you'll get a quick and accurate response. Information on how to create a test case (if you aren't able to link to the page you are working on) is available here.



  • szakendreszakendre Posts: 24Questions: 10Answers: 0

    Dear Colin,

    Unfortunately, I was not able to prepare any test cases.

    But I just found a solution, or workarouind:

    function getUrlParameter(name)
        name = name.replace(/[\[]/, '\\[').replace(/[\]]/, '\\]');
        var regex = new RegExp('[\\?&]' + name + '=([^&#]*)');
        var results = regex.exec(;
        console.log(decodeURIComponent(results[1].replace(/\+/g, ' ')));
        return results === null ? '' : decodeURIComponent(results[1].replace(/\+/g, ' '));


    Best regards:
    Endre, Szak

  • colincolin Posts: 15,226Questions: 1Answers: 2,593

    Nice, thanks for reporting back!


Sign In or Register to comment.