6 examples of 'go to url after ok button in alert is pressed' in JavaScript

Every line of 'go to url after ok button in alert is pressed' code snippets is scanned for vulnerabilities by our powerful machine learning engine that combs millions of open source libraries, ensuring your JavaScript code is secure.

All examples are scanned by Snyk Code

By copying the Snyk Code Snippets you agree to
41function ConfirmURL(text, goto_url) {
42 if (text) {
43 BootstrapDialog.show({
44 type : BootstrapDialog.TYPE_DANGER,
45 title : 'Please confirm',
46 message : text,
47 buttons : [ {
48 label : 'No',
49 cssClass : 'btn-primary',
50 action : function(dialogItself) {
51 dialogItself.close();
52 }
53 }, {
54 label : 'Yes',
55 cssClass : 'btn-success',
56 action : function() {
57 document.location = goto_url;
58 }
59 } ]
60 });
61 }
62}
109function confirmAction(id, url) {
110 //TODO i18n messages
111 var select = document.getElementById(id);
112 var selectedIndex = select.selectedIndex;
113 if (select.selectedIndex == 0) {
114 alert("Please select a value");
115 return;
116 }
117 var value = select.options[selectedIndex].value;
118 url = url.replace(/%target%/gi, value);
119 if (confirm("Are you sure?"))
120 location.href=url;
121}
73function redirectLinkClicked() {
74 var link = jQuery('#secureLinkWithRedirectId');
75 var extraData = link.attr('id') + '=1';
76 var url = link.attr('href');
77 jQuery.get(url, extraData, function(data, textStatus, xhr) {
78 // Retrieve the url to redirect from the Ajax response header
79 var redirect_url = xhr.getResponseHeader('REDIRECT_URL');
80 // Perform the redirect
81 window.location = redirect_url;
82
83 });
84}
319confirm() {
320 this.findNext({focusEditorAfter: atom.config.get('find-and-replace.focusEditorAfterSearch')});
321}
17function wait_url()
18{
19 var text_success = null;
20 var text_fail = null;
21 var func = null;
22 if(arguments.length === 2)
23 {
24 text_success = arguments[0];
25 func = arguments[1];
26 }else if(arguments.length === 3)
27 {
28 text_success = arguments[0];
29 text_fail = arguments[1];
30 func = arguments[2];
31 }else
32 {
33 die("Wrong number of arguments");
34 }
35
36 if(text_fail)
37 {
38 wait(tr("Failed to wait for changing url ") + text_success,function(){
39
40 url(function(){
41 if(_result().indexOf(_arguments()[0])>=0)
42 _set_result(true);
43 })
44 },
45 function(){
46 url(function(){
47 if(_result().indexOf(_arguments()[1])>=0)
48 {
49 _set_result(true);
50 }
51 })
52 },[text_success,text_fail],func);
53
54 }else
55 {
56 wait(tr("Failed to wait for changing url ") + text_success,function(){
57 url(function(){
58 if(_result().indexOf(_arguments())>=0)
59 {
60 _set_result(true);
61 }
62 })
63 },text_success,func);
64 }
65
66}
39async function okIfAlert (driver) {
40 let text;
41 try {
42 text = await driver.getAlertText();
43 } catch (err) {
44 // if NoAlertOpenError (27) continue
45 if (err.jsonwpCode !== 27) {
46 throw err;
47 }
48 }
49 if (text) {
50 await driver.postAcceptAlert();
51 }
52}

Related snippets