Redirect 301 in a new tab/window

Hi All,

I am trying to figure out how to get a 301 redirect in Wordpress to open in a new window?

I am using the Simple 301 Redirect tool with Wordpress

My website -- On the sidebar, I have a redirect in place for the Apply Now link. The only problem, is it opens in the same window, I'd like it to redirect to the new site in a new tab/window.  

Is this possible, and if so, how?
Jon ImmsWeb DeveloperAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Lucas BishopClick TrackerCommented:
Target the window to "_blank":
https://html.com/attributes/a-target/#a_target8221_blank8221_Open_in_New_Browser_Tab_or_Window

Here is your current code:
<a href="https://cheerful-spiders.flywheelsites.com/careers/company-drivers/apply-now/">Apply Now</a>

Open in new window


With target _blank:
<a href="https://cheerful-spiders.flywheelsites.com/careers/company-drivers/apply-now/" target="_blank">Apply Now</a>

Open in new window

Jon ImmsWeb DeveloperAuthor Commented:
I understand  target="_blank.

For this though, The site automatically creates the pages menu in the sidebar. I'm then redirecting the link to another site using 301. so i cannot use target="_blank
Lucas BishopClick TrackerCommented:
Targeting is how this is done. It sounds like your issue is actually with the system hat manages your navigation. Is there no way to specify a target in the system that manages your navigation? That's what you need to be addressing.
Julian HansenCommented:
You can bolt on a JavaScript event handler that will work against your rendered menu. Something like this
$('.nested_nav').on('click','.page_item .page-item-95 a', function(e) {
  e.preventDefault();
  var url = this.href;
  window.open(url,'_blank');
});

Open in new window


Note, I have used page-item-95 as that is the class that is shown in the rendered page - if you change your menu this class may change which means the script will have to change.

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
HTML

From novice to tech pro — start learning today.