link in alert boxes javascript
You can only display text in the alert function. If you want to put an url, you can do it by using jquery's dialog function. Here are some code examples: http://jqueryui.com/dialog/#default
How can I add a url to an alert?
You cannot add arbitrary interface to a UIAlertController. The title and message are not tappable. You cannot add further text. Instead, add another button (UIAlertAction) that directs them to the Web page. Either that, or use some other interface instead of a UIAlertController (for example, you can put up a presented view controller that looks like an alert).
How to add URL links to the alerts?
According to the documentation the description
property accepts either a string
or a ReactNode
. Therefore you can try to define a ReactNode
instead of a string
that contains a Link
component, e.g:
state = {
inValid: (
<div>This is a message because you haven't verified your email. If you haven't so, please click here to Verify Email <Link href="http://bing.com">Bing</Link>.</div>
)
};
How do I put a link to a webpage in a JScript Alert dialog box?
You could try asking them if they wish to visit via window.prompt:
if(window.prompt('Do you wish to visit the following website?','http://www.google.ca'))
location.href='http://www.google.ca/';
Also, Internet Explorer supports modal dialogs so you could try showing one of those:
if (window.showModalDialog)
window.showModalDialog("mypage.html","popup","dialogWidth:255px;dialogHeight:250px");
else
window.open("mypage.html","name","height=255,width=250,toolbar=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=no,modal=yes");
Adding a redirection link to an AlertController button
You can add handler
to your button that can call the method to open your playstore link:
buttons: [ {
cssClass: `cancel-button`,
text: `X`,
},
{
cssClass: `secure-hub`,
text: `Go To Play Store`, //<<<<<<< this button,
handler: () => {
this.yourMethodToOpenUrl()
}
}
Related Topics
Difference Between Object(Forkey:) and Value(Forkey:) in Userdefaults
Swiftui CPU High Usage on Real-Time Foreach View Updating (Macos)
Navigation Bar Items After Push from Swiftui to UIkit
Passing in Variable Number of Args from One Function to Another in Swift
Naming Convention for Private Properties
Swift Display Image UIimageview
How to Find Realm File Location of a MAC App
Override UIgesturerecognizer Touchesbegan
Bad_Access During Recursive Calls in Swift
How to Create Generic Convenience Initializer in Swift
How to Cast from Cftyperef to Axuielement in Swift
How to Check If a Variable Is Nil
Swift: Binary Operator '==' Cannot Be Applied to Operands of Type "Protocol"
Why Would One Use Nested Classes
Is There a Way in Swiftui to Detect If a User Has Larger Text Size Enabled
Swift: Nested Optionals in a Single Guard Statement
How to Initialize a Struct with a Closure Parameter Like This