HTML5 Data Bindings Browser Properties Support Product Page

Answered

I would like to redirect to another web-page on viewport-width.

Asked 08 Jun 2016 08:29:58
1
has this question
08 Jun 2016 08:29:58 Greta Garberini posted:
It seems, I can't find the properties from the browser properties in the data bindings panel. Would I use a behaviour for the redirect?

Replies

Replied 08 Jun 2016 12:31:14
08 Jun 2016 12:31:14 Teodor Kuduschiev replied:
Hello Greta,
The HTML5 Data Bindings Browser Properties does not have behaviors, and this could not be done with it. This extension provides information about the browser/screen/device in data bindings format, so they can be used/binded on the page.
Replied 29 May 2024 09:50:22
29 May 2024 09:50:22 Kris Middle replied:
I also have problems on my website with several pages, I don’t know who to contact, and there are also bugs in my mobile application. Can you recommend a reliable development team?
Replied 29 May 2024 11:22:40
29 May 2024 11:22:40 User  replied:
I have worked with a great app development company many times. They have extensive experience and knowledge in this field, and their team excels at turning any idea into a high-quality product. Read more here https://phenomenonstudio.com/service/website-design/ They prioritize customer needs and constantly strive for excellence.
Replied 29 May 2024 13:43:16
29 May 2024 13:43:16 User  replied:
Here’s a combined and concise version of the code that redirects based,
on viewport width both on page load and when the window is resized:

<!DOCTYPE html>
<html>
<head>
<title>Viewport Width Redirect</title>
<script type="text/javascript">
function redirectBasedOnViewportWidth() {
var viewportWidth = window.innerWidth;
if (viewportWidth < 768) {
window.location.href = "example.com/mobile";
} else if (viewportWidth < 1024) {
window.location.href = "example.com/tablet";
} else {
window.location.href = "example.com/desktop";
}
}
window.onload = redirectBasedOnViewportWidth;
window.onresize = redirectBasedOnViewportWidth;
</script>
</head>
<body>
<h1>Viewport Width Redirect</h1>
<p>If this text is visible, the script didn't run correctly.</p>
</body>
</html>
for more information follow me on my blog. Eduhq

Reply to this topic