mirror of
https://github.com/DioxusLabs/dioxus
synced 2024-11-22 20:23:09 +00:00
25 lines
532 B
Rust
25 lines
532 B
Rust
//! XSS Safety
|
|
//!
|
|
//! This example proves that Dioxus is safe from XSS attacks.
|
|
|
|
use dioxus::prelude::*;
|
|
|
|
fn main() {
|
|
launch(app);
|
|
}
|
|
|
|
fn app() -> Element {
|
|
let mut contents = use_signal(|| String::from("<script>alert(\"hello world\")</script>"));
|
|
|
|
rsx! {
|
|
div {
|
|
h1 {"Dioxus is XSS-Safe"}
|
|
h3 { "{contents}" }
|
|
input {
|
|
value: "{contents}",
|
|
r#type: "text",
|
|
oninput: move |e| contents.set(e.value()),
|
|
}
|
|
}
|
|
}
|
|
}
|