/    Sign up×
Community /Pin to ProfileBookmark

Website stuck in redirect loop

Hi,
My website requires a query parameter (`model=movenet`) to function correctly. Since, I can’t directly add the query parameter to my website , I’m redirecting my website to the one with the query parameter.

My website: https://allzen.tech
My website with query: https://allzen.tech?model=movenet

I’m using this command: `<meta http-equiv=”Refresh” content=”0; url=’https://allzen.tech?model=movenet'” />`
to redirect.

The problem is instead of redirecting once my website is stuck in a redirect loop. I’m more than happy to use an alternative way to set the query parameter than redirect.

Here is the complete `index.html`:

“`html
<!DOCTYPE html>
<html>
<head>
<meta charset=”utf-8″>
<meta http-equiv=”Refresh” content=”0; url=’https://allzen.tech?model=movenet'” />
<meta name=”viewport” content=”width=device-width,initial-scale=1,maximum-scale=1.0, user-scalable=no”>
<style>
body {
margin: 0;
}
#main {
margin: 0;
position: relative;
}
#canvas-wrapper {
margin-top: 80px;
position: relative;
}
canvas {
position: absolute;
top: 0;
left: 0;
}
#top-bar {
margin-left: 300px;
position: relative;
}
</style>
</head>
<body>
<div id=”stats”></div>
<div id=”main”>
<div class=”container”>
<div id=”top-bar”>
<label for=”videofile”>Upload a video file:</label>
<input type=”file” id=”videofile” name=”video” accept=”video/*”>
<button id=”submit”>Run</button>
</div>
</div>
<div class=”container” id=”canvas-wrapper”>
<canvas id=”output”></canvas>
<video id=”video”>
<source id=”currentVID” src=”” type=”video/mp4″>
</video>
</div>
<div class=”container”>
<span id=”status”></span>
</div>
</div>
</body>
<script src=”https://cdnjs.cloudflare.com/ajax/libs/dat-gui/0.7.6/dat.gui.min.js”></script>
<script src=”https://cdnjs.cloudflare.com/ajax/libs/stats.js/r16/Stats.min.js”></script>
<script src=”src/index.js”></script>
</html>
“`

to post a comment

5 Comments(s)

Copy linkTweet thisAlerts:
@NogDogAug 02.2021 — > @thebrainiac#1634972 My website requires a query parameter

Well...my first thought is to fix that, instead of working around it via the redirect approach.

For instance, if the home page is a PHP page:
[code=php]
<?php
if(empty($_GET['model'])) {
$_GET['model'] = 'movement';
}
// rest of code that cares about that parameter...
[/code]

(or something comparable if using another server-side language)

If you really need to do it on the client side, I'd think you'd want to use some JavaScript (which I am not strong with) to determine if that parameter is already set, then do the redirect if not. Maybe https://flaviocopes.com/urlsearchparams/ would be a place to start to see how to access the query string within JavaScript?
Copy linkTweet thisAlerts:
@thebrainiacauthorAug 03.2021 — @NogDog#1634973 Thanks for the suggestions!

There was a similar question on Stack Overflow which was solved using JQuery. But , I don't know JQuery and even if I knew Idk how to use it on firebase.
Copy linkTweet thisAlerts:
@thebrainiacauthorAug 03.2021 — @NogDog#1634973 Thanks for this article https://flaviocopes.com/urlsearchparams/ . It cleared a lot of doubts. I've solved the issue by doing this:
``html<i>
</i> if (!urlParams.has('model')) {
var searchParams = new URLSearchParams(window.location.search)
searchParams.set("model", "movenet");
var newRelativePathQuery = window.location.pathname + '?' + searchParams.toString();
history.pushState(null, '', newRelativePathQuery);
window.location.reload(true);
return;<i>
</i>
``
Copy linkTweet thisAlerts:
@malvikaadhikari65Aug 03.2021 — Great to see your valuable post. I found really informative news in your post. https://www.malvikaadhikari.co.in
Copy linkTweet thisAlerts:
@aaamiracle2021Aug 03.2021 — **How often should my dryer vent be cleaned?**


[Duct Cleaning Vancouver](https://www.aaamiracle.ca/air-duct-cleaning-vancouver/)

A good rule of thumb is to have your dryer exhaust vents inspected and cleaned by a professional at least once per year. However, if you have a household that uses your dryer often, such as one with a lot of children, you may want to consider increasing that amount to every six months.

Duct![Duct](https://ww1.aaamiracle.ca/wp-content/uploads/2012/01/duct-cleaning-1.jpg)
×

Success!

Help @thebrainiac spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 4.20,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,

tipper: @Samric24,
tipped: article
amount: 1000 SATS,
)...