Redirecting user depending on a uri query
Moderator: General Moderators
Redirecting user depending on a uri query
I am working in MIVA (a merchant/online store solution) and I can not get under the hood of their code, so I need to find a way to cheat it. What I need to do is redirect users to a specific page depending on a variable set in the URI, but since I can't get into the backend code, I need to find a way to do it client-side... any ideas?
To answer your second post
Although I believe just the display: none part will do the trick. 
Code: Select all
<iframe src="somepage" height="0" width="0" frameborder="0" style="display: none;"></iframe>Set Search Time - A google chrome extension. When you search only results from the past year (or set time period) are displayed. Helps tremendously when using new technologies to avoid outdated results.
how would I make an iframe invisible/unable to be seen by visitors?
Code: Select all
<html>
<body>
<style type='text/css'>
iframe.hidden {
float:left;
margin-left:-100000;
}
/* or simply */
/*
iframe.hidden {
display:hidden;
height:1px;
}
*/
/* or */
/*
iframe.hidden {
display:none;
}
*/
</style>
<iframe id='hiddenFrame' name='hiddenFrame' class='hidden'></iframe>
</body>
</html>
ok... I have another question
in the iframe i called a php script which tests whether the $_GET variable is set and I set the $_GET variable (in the parent window). The iframe test says that it isn't set because the variable isn't being set in the iframe. How do I pass the query string from the URI to the iframe?
in the iframe i called a php script which tests whether the $_GET variable is set and I set the $_GET variable (in the parent window). The iframe test says that it isn't set because the variable isn't being set in the iframe. How do I pass the query string from the URI to the iframe?
Code: Select all
<iframe src="somepage.php?<?php echo $_SERVER['QUERY_STRING']; ?>">Set Search Time - A google chrome extension. When you search only results from the past year (or set time period) are displayed. Helps tremendously when using new technologies to avoid outdated results.
The problem with that is that the parent frame needs to be a standard html page... can't put php in the parent frame... 
I don't think this iframe thing is going to work... it won't redirect the parent frame without the use of javascript, so I may as well just put the javascript on the parent frame... but I am lame in javascript.
Is there a way to redirect with javascript depending on the query string?
I don't think this iframe thing is going to work... it won't redirect the parent frame without the use of javascript, so I may as well just put the javascript on the parent frame... but I am lame in javascript.
Is there a way to redirect with javascript depending on the query string?
Just in case somebody comes to this thread with the same question... I solved the problem like this:
Code: Select all
<script language="javascript" type="text/javascript">
function getQueryVariable(variable) {
var query = window.location.search.substring(1);
var vars = query.split("&");
for (var i=0;i<vars.length;i++) {
var pair = vars[i].split("=");
if (pair[0] == variable) {
return pair[1];
}
}
return false;
}
var cat_code = getQueryVariable("Category_Code");
if(cat_code == "AR"){
window.location = "http://www.somedomain.com/mm5/merchant.mvc?Screen=ARTS&Category_Code=AR&Store_Code=T";
}
else if(cat_code == "SP"){
window.location = "http://www.somedomain.com/mm5/merchant.mvc?Screen=SPTF&Category_Code=SP&Store_Code=T";
}
</script>