S
sawyersam44
Hi All
Programming newbie here, so please be gentle
I've noticed some websites have a URL checking script that check to see
the URL in the address bar of the browswer, and can reload/redirect the
page based on this. For example, take the chunk of code below (excuse
the ugly formatting - its a decent size chunk, and I tried to compact
it somewhat)
<script language="JavaScript">
checkURL();
function checkURLl() {
try
{ if (
top.location.hostname!="www.yahoo.com") {
exit=false;
if ( (top.location.hostname).indexOf("yahoo") != -1 )
{ parent.location="http://www.yahoo.com"; }
} }
catch(e)
{
exit=false;
var loc = document.URL;
if ( loc.indexOf("yahoo") != -1 )
{ parent.location="http://www.yahoo.com"; }
} }
function placeFocus() {
checkURL();
if (document.forms.length > 0) {
var field = document.forms[0];
for (i = 0; i < field.length; i++) {
if ((field.elements.type == "text") || (field.elements.type ==
"textarea") || (field.elements.type.toString().charAt(0) == "s")) {
document.forms[0].elements.focus();
break;
} } } }
</script>
This code is (supposed) to make sure that the proper URL is in the
address bar (here it would be yahoo.com), and if not, it would reload
the browser using the proper URL. An example of this would be someone
who is hiding the URL they are sending you to using frames. So even
though you are looking at the yahoo.com website, the URL in your
address bar shows something besides yahoo.com. Is there a way to defeat
this script short of disabling Javascript in the browser?
TIA
Samantha
Programming newbie here, so please be gentle
I've noticed some websites have a URL checking script that check to see
the URL in the address bar of the browswer, and can reload/redirect the
page based on this. For example, take the chunk of code below (excuse
the ugly formatting - its a decent size chunk, and I tried to compact
it somewhat)
<script language="JavaScript">
checkURL();
function checkURLl() {
try
{ if (
top.location.hostname!="www.yahoo.com") {
exit=false;
if ( (top.location.hostname).indexOf("yahoo") != -1 )
{ parent.location="http://www.yahoo.com"; }
} }
catch(e)
{
exit=false;
var loc = document.URL;
if ( loc.indexOf("yahoo") != -1 )
{ parent.location="http://www.yahoo.com"; }
} }
function placeFocus() {
checkURL();
if (document.forms.length > 0) {
var field = document.forms[0];
for (i = 0; i < field.length; i++) {
if ((field.elements.type == "text") || (field.elements.type ==
"textarea") || (field.elements.type.toString().charAt(0) == "s")) {
document.forms[0].elements.focus();
break;
} } } }
</script>
This code is (supposed) to make sure that the proper URL is in the
address bar (here it would be yahoo.com), and if not, it would reload
the browser using the proper URL. An example of this would be someone
who is hiding the URL they are sending you to using frames. So even
though you are looking at the yahoo.com website, the URL in your
address bar shows something besides yahoo.com. Is there a way to defeat
this script short of disabling Javascript in the browser?
TIA
Samantha