Im trying to make a html or javascript code to make it were when the alertbox ok button is pressed it will send yu to another site is there any error?

Mr.nobody

right now im useing code like this to redirect me to another website--> alert("close this tab 2 run"); window.location = 'https://www.google.com/?safe=active&ssui=on'; console.log("This code is executed after alert"). im just wondering if anyone could help me?

btw i just need someone to tell me if there is a error:)

JeroenJ

Is this what you need?

if (window.confirm('close this tab 2 run')) {
    // When the 'Yes' button is clicked
    window.location = 'https://www.google.com/?safe=active&ssui=on';
    console.log("This code is executed after alert");
}
else {
    // When the 'No' button is clicked
}

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

Trying to make a button in html with javascript

Trying to make send a message when the enter key is pressed

Trying to make unity only continue the script when a button is pressed

Error when trying to make another query on Firestore

Javascript: How to make fade in and out transition when button is pressed?

Execute the javascript when button is pressed from html code?

Make a form run a javascript when ENTER is pressed or its button is pressed, without submitting

Make Button NOT change title color when pressed

Make next button on AeroWizard disabled until another button is pressed

Change TabbarView in Flutter When pressed button from another class and also need to make swipe-able

How to make a button that creates a button when clicked (in HTML and JavaScript)?

Make Error 127 when running trying to compile code

i'm trying to make a number guesser so when the button is pressed it should begin the game, the button works but the game will not begin

Any suggestion to make my javascript + html code smaller

Im geting this error trying to make an import on IONIC

Trying to make a button display something when another button is clicked (C#)

Make matplotlib button widget actuate when pressed, not when released

Trying to make a rectangle move in canvas when a key is pressed but it will not work

Is there any way to make the site go to another page when the browser window is resized?

Trying to make a program that fixes the code of another program

I'm trying to make the input entered from the textfield the new name of my list when the save button is pressed, but it didn't work

Trying to make a button clickable with HTML and CSS

Problem when trying to make a circular button on kivy

Trying to debounce this button for when pressed

How can I make a new scene fade in when a button is pressed?

How to make ios app stop when home button pressed

How to make a Flutter button log to the console when pressed?

How to make fragment replaced by a specific fragment when back button pressed

Ionic 3: How make ionViewWillEnter only when back button pressed?