Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

257
Vistas
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 Respuestas
Responde la pregunta

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 Denunciar

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 Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda