Forwarding to another URL from EventHandler
kevindeyne opened this issue · 0 comments
kevindeyne commented
If I click a button, I might want the action to be a redirect to another page.
Doing this now requires you to set up a DomChanges response and hooking in a little bit of custom JS:
<script>
//redirect script once loaded - should eventually be a Medusa feature
var _M = _M || {};
_M.postRender = function (incomingMessage) {
if(incomingMessage !== null && typeof incomingMessage !== "undefined" && incomingMessage.length === 1) {
if("redirect" === incomingMessage[0]['f']) {
window.location.href = incomingMessage[0]['v'];
}
}
};
</script>
Could probably do something similar.
I also wish to be able to do this from the PageAttributes setupAttributes() method, in case the loading of the page necessitates it for me to redirect.