Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

256
Views
How to add a command to launch a new tab in the browser with this code in JavaScript? (etc.) (with Terminal)

I'm a noob. I have a code to simulate a terminal. This is it: https://codepen.io/isdampe/pen/YpgOYr.

Command:

 var coreCmds = {
    "clear": clear
  };

Answer (clear the screen):

function clear(argv, argc) {
    termBuffer = "";
    return "";
  }

As mentioned in the title, how to add a command to launch a new tab in the browser (to google.com for example, or anywhere else)?

Thank you.

about 4 years ago · Juan Pablo Isaza
2 answers
Answer question

0

window.open();


The open() method opens a new browser window, or a new tab, depending on your browser settings and the parameter values.

Here's an example:

window.open("https://www.google.com");

Structure:


window.open(URL, name, specs, replace)

Since you want to open a new tab in browser, you should put _blank in name. However, this is the default.

What would your code look like?


This is a rough outline, replace variable names and arguments as you like

 var var_name = {
    "new window": new_window
  };

function new_window(arguments) {
    termBuffer = "";
    return window.open(arguments);
  }

I hope this helps :D

about 4 years ago · Juan Pablo Isaza Report

0

Use the window.open method with an input URL.

window.open('https://google.com')

This would open a tab to https://google.com.

about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!