Expand my Community achievements bar.

Submissions are now open for the 2026 Adobe Experience Maker Awards.

Mark Solution

This conversation has been locked due to inactivity. Please create a new post.

SOLVED

CQ and Javascript redirection

Avatar

Former Community Member

Good afternoon.

Im trying to write a little javascript, that detects mobile agents.

If the agent is a mobile device, redirect.

<script>
window.onload = function() {
    if(/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent)) {
        // If Mobile: Redirect
        window.location.replace("http://www.externalurl.com");
    }
}
</script>

Unfortunately, CQ doesnt like external URL redirection.
Is it possible, inside CQ to redirect from the client?
And if it is, how does one do it?

Kind regards
Toby

1 Accepted Solution

Avatar

Correct answer by
Level 10
2 Replies

Avatar

Correct answer by
Level 10

Avatar

Former Community Member

Thanks, will look into that.

But the question still stands.
How does one redirect in javascript to an external URL?

Kind regards
Toby