You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: controls/editor/how-to/preserve-content-on-back-button.md
+9-7Lines changed: 9 additions & 7 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -10,32 +10,34 @@ position: 11
10
10
11
11
# Preserve the Content in RadEditor when Using Back Button
12
12
13
-
**RadEditor UI for ASP.NET AJAX**looses its content when user navigates out of the page and comes back by using the **Back** button of the browser. Browsers automatically preserve the content in such scenario only for form elements like `<textarea>`, `<input/>` and so on. **RadEditor**, however, is an editable DOM element that the browser does not consider as a form element field so to preserve its contents automatically.
13
+
**RadEditor for ASP.NET AJAX**loses its content when the user navigates out of the page and comes back by using the **Back** button of the browser.
14
14
15
-
Possible solutions:
15
+
Browsers automatically preserve the content in such scenario only for form elements like `<textarea>`, `<input/>` and so on. **RadEditor**, however, is an editable DOM element that the browser does not consider as a form element field and does not preserve its contents automatically.
16
+
17
+
**Possible solutions**:
16
18
17
19
* For **Chrome** and **Firefox**: You can use the `window.onbeforeunload` event in order to detect that user navigates out of the page and save the content of **RadEditor** in its own hidden `<textarea>`.
18
20
19
21
>caption Example 1: Solution with `window.onbeforeunload` event.
* For all browsers: IE cannot preserve the content during `window.onbeforeunload` and you can either save the content in the `<textarea>` while text is being typed in, or by using a `setTimeout` to not affect the performance of your page.
35
+
* For all browsers: IE cannot preserve the content during `window.onbeforeunload` and you can either save the content in the `<textarea>` while text is being typed in, or by using a `setInterval` to not affect the performance of your page.
34
36
35
37
>caption Example 2: Solution with `onkeyup` event.
0 commit comments