473,320 Members | 1,746 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

how to hack this setTimeout() ??

I wonder if there is a way to change some variable of Javascript in an
html while running? For example, I load this page in IE. The page use
setTimeout() in order to call Submit of a form in 10 min. I wonder if
there is a way to change the time. Generally speaking, is there a way
to access into variables of Javascript while running?
Thank you.
Jul 23 '05 #1
11 5802
Hoc Phan wrote on 13 jun 2004 in comp.lang.javascript:
I wonder if there is a way to change some variable of Javascript in an
html while running? For example, I load this page in IE. The page use
setTimeout() in order to call Submit of a form in 10 min. I wonder if
there is a way to change the time. Generally speaking, is there a way
to access into variables of Javascript while running?


mytimeout = setTimeout('do()',20000)

later reset the time by:

mytimeout = setTimeout('do()',400)
--
Evertjan.
The Netherlands.
(Please change the x'es to dots in my emailaddress)
Jul 23 '05 #2
You misunderstand my point. The page from the internet is opened by IE
and I need to change the timeout without edit html code. I'm looking
for a way to interfere with javascript variables in PC memory. Or is
there anyway to make this timeout stop working? Thanks.
Jul 23 '05 #3
On 14 Jun 2004 06:02:39 -0700, qu******@netzero.net (Hoc Phan) wrote:
You misunderstand my point. The page from the internet is opened by IE
and I need to change the timeout without edit html code. I'm looking
for a way to interfere with javascript variables in PC memory. Or is
there anyway to make this timeout stop working? Thanks.


go to the urlbar and go:

javascript:clearTimeout(Moomin);void 0

where Moomin is the part of the script that says:

Moomin=setTimeout( ... )

if it doesn't say Moomin = .... but just a bare setTimeout - then
you'll need to get proxomitron or similar into the act to change the
behaviour.

Jim.
--
comp.lang.javascript FAQ - http://jibbering.com/faq/

Jul 23 '05 #4
Hoc Phan wrote on 14 jun 2004 in comp.lang.javascript:
You misunderstand my point. The page from the internet is opened by IE
and I need to change the timeout without edit html code. I'm looking
for a way to interfere with javascript variables in PC memory. Or is
there anyway to make this timeout stop working? Thanks.


So what timeout are you talking about ?

The caching timeout perhaps ?
[The one you set in the header]

Clientside javascript cannot and should not be able to get at such
variables.

--
Evertjan.
The Netherlands.
(Please change the x'es to dots in my emailaddress)
Jul 23 '05 #5
Well, here is the example. There is a page, let say, giving a quiz,
which have setTimeout() to submit after 15 min. How to stop this
javascript from running and submit the form automatically after 15
min? I'm looking for a way to increase the time by changing some hex
value in the memory. Just like hacking into software.
Jul 23 '05 #6
Hoc Phan wrote:
Well, here is the example. There is a page, let say, giving a quiz,
which have setTimeout() to submit after 15 min. How to stop this
javascript from running and submit the form automatically after 15
min? I'm looking for a way to increase the time by changing some hex
value in the memory. Just like hacking into software.


Isn't that cheating? However, it serves whoever wrote the quiz right for
relying on client-side scripting for the timing information (the server
should be doing that, and may be doing it anyway).

Almost certainly you will be able to do what you want, but nobody can
tell you how without seeing the code in question (hacking hex values is
not how it is done in javascript). First we will need to see the
setTimeout call, and maybe some of the HTML, like the opining FORM tag
(a URL might be useful). It might also be useful to know which browser
you intend to be using.

Richard.

Jul 23 '05 #7
Hoc Phan wrote on 15 jun 2004 in comp.lang.javascript:
Well, here is the example. There is a page, let say, giving a quiz,
which have setTimeout() to submit after 15 min. How to stop this
javascript from running and submit the form automatically after 15
min? I'm looking for a way to increase the time by changing some hex
value in the memory. Just like hacking into software.


Memory has no hex values only binaries, unless they are burried in a
string [consisting of binaries too]. A interpreting programme like a
Javascript engine uses it's own internal representations of [typed]
numbers in memory.
For hacking into software, you have still much to learn.

=========================

If you know the string of the clientside timeout and it has a name,
you clould make a favelet (IE).

Say the string is:

mytimot = setTimeout('do()',15*60*1000);

The favelet called "ImCheatingImBad.url" could contain:

[InternetShortcut]
URL=javascript:mytimot=setTimeout('do()',60*60*100 0);void 0

Put the favelet in the links Toolbar.

==========================

But why the bother? Just rewrite the offending page as a local html,
Phan, including a <base href=''> to the original location.

--
Evertjan.
The Netherlands.
(Please change the x'es to dots in my emailaddress)
Jul 23 '05 #8
Evertjan. wrote:
<snip>
If you know the string of the clientside timeout and it has a name,
you clould make a favelet (IE).

Say the string is:

mytimot = setTimeout('do()',15*60*1000);

The favelet called "ImCheatingImBad.url" could contain:

[InternetShortcut]
URL=javascript:mytimot=setTimeout('do()',60*60*100 0);void 0

<snip>

I don't see this helping much because it is scheduling a second
execution of the - do - function. The first is still going to happen
approximately 15 minutes after the first call to setTimeout. In this
case I would be inclined to attack the - do - function, replacing it
with a dummy. But that might not be so simple if the call is:-

setTimeout('document.forms[0].submit()', 15*60*1000);

- depending on the browser. And if the call was along the lines of:-

setTiemout(do, 15*60*1000);

- (by function reference) it might be necessary to look into the - do -
function and see what it was up to.

On the other hand Proxomitron has a built in filter that will kill all
calls to setTimeout/Interval.

Richard.
Jul 23 '05 #9
Richard Cornford wrote on 15 jun 2004 in comp.lang.javascript:
mytimot = setTimeout('do()',15*60*1000);

The favelet called "ImCheatingImBad.url" could contain:

[InternetShortcut]
URL=javascript:mytimot=setTimeout('do()',60*60*100 0);void 0

<snip>

I don't see this helping much because it is scheduling a second
execution of the - do - function. The first is still going to happen
approximately 15 minutes after the first call to setTimeout.


Not true.

If you give the timeouts the same name "mytimot" the first one is
automatically cancelled.

If you do not want to prolong but to cancel the timeout:

[InternetShortcut]
URL=javascript:window.clearTimeout(mytimot);void 0

will do.

--
Evertjan.
The Netherlands.
(Please change the x'es to dots in my emailaddress)
Jul 23 '05 #10
Evertjan. wrote:
Richard Cornford wrote: <snip>
I don't see this helping much because it is scheduling a second
execution of the - do - function. The first is still going to happen
approximately 15 minutes after the first call to setTimeout.


Not true.


?
If you give the timeouts the same name "mytimot" the
first one is automatically cancelled.

<snip>

In your code "mytimot" is not given to the - setTimeout - call,
"mytimot" receives the return value from the call. The second time it
happens "mytimot" receives a different value, but the timeout system
doesn't know about that, or have any interest. The first time out will
still trigger the execution of its string argument as originally
scheduled. Try it:-

<script type="text/javascript">
var m = setTimeout('alert(\'1\')',500);
m = setTimeout('alert(\'2\')',1500);
</script>

Richard.
Jul 23 '05 #11
Richard Cornford wrote on 15 jun 2004 in comp.lang.javascript:
In your code "mytimot" is not given to the - setTimeout - call,
"mytimot" receives the return value from the call. The second time it
happens "mytimot" receives a different value, but the timeout system
doesn't know about that, or have any interest. The first time out will
still trigger the execution of its string argument as originally
scheduled. Try it:-

<script type="text/javascript">
var m = setTimeout('alert(\'1\')',500);
m = setTimeout('alert(\'2\')',1500);
</script>


You are right.

So use clearTimeout() instead.

--
Evertjan.
The Netherlands.
(Please change the x'es to dots in my emailaddress)
Jul 23 '05 #12

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: domeceo | last post by:
can anyone tell me why I cannot pass values in a setTimeout function whenever I use this function it says "menu is undefined" after th alert. function imgOff(menu, num) { if (document.images) {...
4
by: Mool | last post by:
I want to use a setTimeout to just loop for a number of seconds, then fall through to the next bit of code...can this be done by using some kind of null in the statement, or do I have to assign the...
18
by: Frances Del Rio | last post by:
this code is supposed to flip imgs at intervals of one second, but it flipps them much faster, it seems it flips them all in that first second, the more seconds the faster it flips them, instead of...
2
by: Athanasius | last post by:
Could someone shed some light as to why the following setTimeout function will not work on the Mac IE5.2? It does however work on PC(Forefox,Netscape,IE) & Mac(Safari,Firefox). Here is the script,...
6
by: Brent | last post by:
Is there any obvious reason why there's no delay in the execution of setting the id.style.display when this function gets called? function Hide(divId,timeout) { var id =...
12
by: Andrew Poulos | last post by:
With the following code I can't understand why this.num keeps incrementing each time I create a new instance of Foo. For each instance I'm expecting this.num to alert as 1 but keeps incrementing. ...
28
by: Andre | last post by:
Hi, Does anyone know whether the ECMA, or an other standard document, specifies a maximum for the value that can be pass to the setTimeOut() function in Javascript? Andre
4
by: E | last post by:
I am having trouble with setTimeout working on a second call to the setTimeout function from a second page which is an html page. Here is the scenario. I have a web page and onload it calls a...
6
by: daveyand | last post by:
Hey Guys, I've stumped. I created a function that does various things to select boxes. Namely Get All selected indexes, populate array with these values
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.