launch new tab and refresh original page codeigniter

// Step 1: In your controller method, load the URL helper
$this->load->helper('url');

// Step 2: Get the current URL
$current_url = current_url();

// Step 3: Generate a unique identifier for the new tab
$tab_identifier = uniqid();

// Step 4: Build the URL for the new tab, appending the unique identifier as a query parameter
$new_tab_url = $current_url . '?tab=' . $tab_identifier;

// Step 5: Use JavaScript to open the new tab and redirect it to the generated URL
echo '<script>window.open("' . $new_tab_url . '", "_blank");</script>';

// Step 6: Redirect the original page to itself to trigger a refresh
redirect($current_url);