1

Not actually, about programming, but more about programming tools (Firebug, Chrome Developer Tool). I understand from the FAQ that this is ok here. I am stumbling on a legacy redirect in one of our HTML pages, and cannot get rid of it, neither with Chrome Developer Tools, nor Firebug. This is this bit of inline code, inserted in the HTML file body:

<SCRIPT type=text/javascript><!--
Redirect();
function Redirect()
{
location.href = 'https://another/page/';
}
// --></SCRIPT>

Unfortunately, I don't have access to this page's source. I want to avoid the execution of this snippet, while keeping all the rest of Javascript active. The goal is simply to change the redirection URL, by accessing some admin controls that need Javascript to work! (I know we put ourselves in a big mess...)

I tried to use the most of the Chrome Developer Tools/Firebug to get me out of this, but may be lacking experience with them. What I tried: Set a breakpoint with Firebug on the location.href = ... line. Unfortunately, both Firebug and Chrome Developer Tool keeps all Javascript execution frozen during the breakpoint. There's AFAK no option to cancel the location.href = execution while retaining other Javascript code active, patch the code, or to use the admin panels meanwhile. I also investigated greasemonkey's behavior, but don't see any obvious way to make it work for me here.

Gerard Yin
  • 1,283
  • 1
  • 12
  • 24

1 Answers1

1

Try overriding the method in your html page and see if it works

function Redirect()
{
location.href = 'https://another/page/';
}

with function Redirect() {

}

Hope I helped

Chakradhar Vyza
  • 285
  • 4
  • 11
  • 1
    Thanks. I'll mark this one as accepted, though I had to do a few enhancements to make it work. I had to set a break-point to the line where `Redirect()` was called. And at this place, use the following snippet: Redirect = function() {} and unpause. The new (empty) function would be called instead of the redirection. The tricky part was that the page was being reloaded at almost every click, so I had to set the break point every time. (Press `Esc` fast enough to cancel the page execution and set the break-point). Not really fun, but now I'm done with it. – Gerard Yin Oct 07 '13 at 12:20