Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is it possible for a website to know if you edit their javascript variables?

Tags:

javascript

So I am forced to complete an online course for my school that uses javascript functions to ensure each student stays on the page for at least a "required_variable" amount of time. Now using the javascript console I am able to just reset the required_variable amount of time to 0, thus allowing me to go to the next page without waiting their amount of time. So my question is whether the website could possibly know that I am resetting their variable. I looked at their code, and I seriously doubt that this particular website can, but I am more wondering because I design websites and there are certain javascript variables I wouldn't want to be overridden in some of my websites.

like image 983
John Mathews Avatar asked Jun 01 '13 20:06

John Mathews


People also ask

How do I inspect a JavaScript variable in Chrome?

We can then check what values are stored in any variable at that point of time. Click F12 to open Developer Tools in Chrome. Or we can right-click and select Inspect (Ctrl+Shift+I).

Which you Cannot use at the time of declaring a variable in JavaScript be careful?

keywords/reserved words cannot be used when declaring variables in js E.g;var,let,this,const,import etc....

How do we tell JavaScript that we're working with a variable?

Variables are named values and can store any type of JavaScript value. var x = 100; And here's what's happening in the example above: var is the keyword that tells JavaScript you're declaring a variable.


2 Answers

whether the website could possibly know that I am resetting their variable

Yes, there's Object.watch() from Mozilla and generic implementations for all browsers (e.g. Listening for variable changes in JavaScript or jQuery - a number of examples there).

In such a case the "watch function" could for example call back to the server to notify.

like image 187
Marcel Stör Avatar answered Sep 21 '22 06:09

Marcel Stör


The exact time you clicked on the Next/Answer button could be recorded server side; the exact time your browser requested each page is logged by the server along with your IP so it'll always be possible to analyse your behaviour for the past year. Though it's unclear why or if they would do that.

Risk analysis: what would you gain from doing what you intend to do? What would you risk? If it seems dumb to you (I don't know, you gave little details... with reasons :) ), it may be super mega important to them to enforce this rule... and be mad at you.
tl;dr don't

like image 27
FelipeAls Avatar answered Sep 21 '22 06:09

FelipeAls