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

106
Views
Botón de programa para abrir una nueva página si se hace clic en iframe, pero en la misma página si se hace clic fuera de iframe

Estoy creando un IDE de Python simple 'en el navegador' (aquí: coder.computerscienceuk.com/coder) y tengo un botón Guardar que guarda el código del editor en una nueva URL.

¿Cómo puedo programar el botón Guardar para que cuando visite el sitio web principal abra la nueva URL en la misma página (como lo hace actualmente) pero si se hace clic en el botón desde dentro de un iFrame (incrustado en otro sitio) fuerza la nueva URL abrir en una nueva ventana/pestaña?

Aquí está mi código de botón:

 function remix(private) { var private = private; var codedata = myCodeMirror.getValue(); var uid = $js_userID; var ide = $js_ide; var response; if (private == 1 && uid == 0) { alert("You need to be logged in to save to a private URL"); } else { $.ajax({ type: "POST", url: {$js_url} + '/wp-content/plugins/CSUKCODER/remix.php', data: {"codedata" : codedata, "uid" : uid, "ide" : ide, "private" : private}, success: function(data) { response = data; response = response.replace('"',''); response = parseInt(response); hashids = new Hashids(); id = hashids.encode(response); window.open($js_urlpage + String(id), '_self') }, error: function (request, status, error) { alert(request.responseText); } }); }; } <img src="$pluginRootPath/img/diskette.png" style="height:45px; padding-left:10px; cursor:pointer;" onclick="remix(0)" title="Save to URL">
about 4 years ago · Juan Pablo Isaza
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!