From ba8dbbe4e7cf9bce5d3b144e5683150b1ab49f21 Mon Sep 17 00:00:00 2001 From: David Botton Date: Tue, 20 Sep 2022 14:33:54 -0400 Subject: [PATCH] url-rewrite --- source/clog-location.lisp | 5 +++-- source/clog-window.lisp | 11 +++++++++++ source/clog.lisp | 1 + 3 files changed, 15 insertions(+), 2 deletions(-) diff --git a/source/clog-location.lisp b/source/clog-location.lisp index 7b0225d..ddf88b6 100644 --- a/source/clog-location.lisp +++ b/source/clog-location.lisp @@ -176,7 +176,7 @@ ;;;;;;;;;;;;;;;;; (defgeneric url-replace (clog-location replace-url) - (:documentation "Replace browser url, ie a redirection and current URL not + (:documentation "Replace browser url, i.e. a redirection and current URL not saved in session history and back button will not return to it.")) (defmethod url-replace ((obj clog-location) replace-url) @@ -187,7 +187,8 @@ saved in session history and back button will not return to it.")) ;;;;;;;;;;;;;;;; (defgeneric url-assign (clog-location assign-url) - (:documentation "Assign browser url.")) + (:documentation "Assign browser url, i.e. a redirection to assign-url +that will be saved in session histoy and back button will return to it.")) (defmethod url-assign ((obj clog-location) assign-url) (execute obj (format nil "assign('~A')" assign-url))) diff --git a/source/clog-window.lisp b/source/clog-window.lisp index 3789e2e..1cc662a 100644 --- a/source/clog-window.lisp +++ b/source/clog-window.lisp @@ -40,6 +40,17 @@ window.")) (execute obj (format nil "name='~A'" (escape-string value))) value) +;;;;;;;;;;;;;;;;; +;; url-rewrite ;; +;;;;;;;;;;;;;;;;; + +(defgeneric url-rewrite (clog-window rewrite-url) + (:documentation "Rewrite browser history and url with REWRITE-URL +no redirection of browser takes place.")) + +(defmethod url-rewrite ((obj clog-window) rewrite-url) + (execute obj (format nil "history.replaceState({},'','~A')" rewrite-url))) + ;;;;;;;;;;;;;;;; ;; status-bar ;; ;;;;;;;;;;;;;;;; diff --git a/source/clog.lisp b/source/clog.lisp index 8bf7b72..42cd323 100644 --- a/source/clog.lisp +++ b/source/clog.lisp @@ -927,6 +927,7 @@ embedded in a native template application.)" "CLOG-Window - Properties" (window-name generic-function) + (url-rewrite generic-function) (inner-height generic-function) (inner-width generic-function) (outer-height generic-function)