There are several links (and pieces of Javascript) throughout our site that contain /2012/responses/{pathParams...}
and I now need to conditionally add to the path, if it's a webview.
if (isWebview) {
// use '/2012/responses/webview/{pathParams...}'
} else {
// use '/2012/responses/{pathParams...}'
}
I can handle the links by inspecting document.links
, but I'm wondering if there's a way to handle pieces of Javascript that use window.location = '/2012/responses/...'
. One method is to create a function that does the window.location change and replace the window.location statements with the function. But, is there a way to handle it as an event, so when the page is changing I could conditionally insert the /webview
in the URL? Browser restrictions seem to limit the beforeunload
event to only prompting the user.