Jump to content

Need help to stop redirecting

- - - - -

  • Please log in to reply
12 replies to this topic

#1
chaitu

chaitu

    Newbie

  • Members
  • Pip
  • 7 posts
Hi
I am trying to stop redirecting the webpage to another. This is the code to <script type="text/javascript">
if(window.top.location.href!="url")

window.top.location.href ="url";

</script>

My Question is How I can stop this redirecting to another page? Could anybody help me on this. I know there is one option that I can use this option: Are you sure to navigate from this page code? But Is there any option to stop redirecting the webpages?


Thanks in advance

#2
wim DC

wim DC

    Writes binary right handed and hex left handed

  • Members
  • PipPipPipPipPipPipPipPipPip
  • 2,084 posts
  • Programming Language:Java, JavaScript, PL/SQL
  • Learning:Java
ehm.. remove that code, and it stops redirecting?

#3
chaitu

chaitu

    Newbie

  • Members
  • Pip
  • 7 posts
But, How can we stop redirecting the webpages with the above code in? Is there any code to use it on our webpages?

#4
chaitu

chaitu

    Newbie

  • Members
  • Pip
  • 7 posts
But, How can we stop redirecting the webpages with the above code in? Is there any code to use it on our webpage?

#5
wim DC

wim DC

    Writes binary right handed and hex left handed

  • Members
  • PipPipPipPipPipPipPipPipPip
  • 2,084 posts
  • Programming Language:Java, JavaScript, PL/SQL
  • Learning:Java
Well, you could disable javascript in the webbrowser.

#6
chaitu

chaitu

    Newbie

  • Members
  • Pip
  • 7 posts
I know there is a code to stop this: <script type="text/javascript">
window.onbeforeunload = function () {
return "This will end your session";
}
</script>


But when anybody opens the page, it will ask are you sure to navigate away. But Is there any other alternative to stop?

#7
Alexander

Alexander

    It's Science!

  • Moderators
  • 4,118 posts
  • Location:Vancouver, Eh! Cleverness: 200
Note: I have moved your thread to JavaScript forum, Java is not JavaScript.
Be sure to read the updated FAQ! || Health is achieved through the same 10,000 steps.
If a suggested code/method fails, informing us is less important than telling us why or what errors occurred.

#8
chaitu

chaitu

    Newbie

  • Members
  • Pip
  • 7 posts
Thanks

#9
chaitu

chaitu

    Newbie

  • Members
  • Pip
  • 7 posts
Can Anybody answer the above question. Please?

#10
opwuaioc

opwuaioc

    Programming Professional

  • Members
  • PipPipPipPipPip
  • 216 posts
It's late, I've been drinking, so my logic might be fuzzy, but have you tried placing the code within some other code? Or are you trying to sidestep something that checks whether the code is in there? If it will only check the source code, try placing it within HTML comments vel sim.
Something witty here.

#11
chaitu

chaitu

    Newbie

  • Members
  • Pip
  • 7 posts
Hi

Could you please give an example, How I can place it HTML comments.

#12
CommittedC0der

CommittedC0der

    Speaks fluent binary

  • Members
  • PipPipPipPipPipPipPipPip
  • 1,565 posts
I dont really know any JS but couldnt you go:
<script type="text/javascript"> 
if(window.top.location.href!="#")

window.top.location.href ="#";
 
</script> 

A man can be defined by what he does when no one is looking.
Science is only an educated theory, which we cannot disprove.




1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users