I am trying to conduct a online quiz competition for an event, I have disabled the user from selecting text, images etc.
But now important thing I need is to disable navigation. User should not be able to navigate to other window, or even can not open any other program for help until the quiz ends.
This page is created using HTML, PHP and Java Script.
Thanks for any help.
Your website is handled by the browser. No browser will allow you to access the desktop to this extent and put restrictions like this. Generally for such things, websites keep time limit. Since the websites cant control if the user refers somewhere else, they can control how much time you take to answer each question. You can set a time such that they may not get enough time to refer. Also you need to make sure that handling the time is fully done from php not js. Php can have a session variable to save the time when the question is request and when the answer is submitted, the php code can check how much time the user has taken. If you try from js it maybe easier by can be edited from the user.
If you still want to stop the user from using any other application, you need to create a software not a website.
Related
I've done plenty of web development at a pretty basic level, and usually just local pages to be called from shared network drives.
Here is where I'm stuck:
I am attempting to build a simple application for work where other leads and I can open a local html page from our shared drive, and add/remove employee names to different tasks, so we can keep tabs on who's doing what.
The tasks are the same every day, just hardcoded titles on sectioned out divs.
Problem is, I can't figure out how to make it to where changes I make will populate for other people with the window open (considering this is just a local page and not a live environment being hosted on anything).
For the general design, I've toyed with hard coding all the employee names under each task in hidden div tags, with a bit of jquery to make the div visible when that worker is assigned.
I have also toyed with appending data to the existing tags using .innerHTML.
Still have no idea how to make this live so we can see each others changes.
Can you point me in the right direction?
I've figured it out. It may be a bit on the lazy side, but i'm just setting the HTML page to auto refresh every 5s. The data displayed will pull from a notepad doc that leads will be able to update and save.
I am assuming that you just want your peers to be able to see the changes your making live? If so you need to use Ajax. You could set it to ping the server every so often to update on the fly. I'm still quite uncertain as to whether or not that was your question, but if not please elaborate or post your code so I can help further.
I want to write page, which enables spying activity of another user.
Two users watches the same page, which is very simple (vertical scrollbar, inputs, buttons, checboxes...).
Each actions performed by first user on his page is immediately seen for second user.
For example, if first user clicks button, then second user watches that click on his own page (pages of both user looks identically).
Simply, second user can see everything what the first user is doing (in real time)
Of course, I assume, that I control the code of this webpage.
And my questions:
Is there a simple way to do that, or I have to write handler for each event and send data to second user using Ajax Web Sockets explicitly?
Is it possible to intercept the frame of another user without necessity of handle each action?
I wrote basic version of this spying program, which is based on websockets. Each action performed by first user is send to another user.
After receiving a message, program parse data, and invokes appropriate method, so I have the same behaviour on both pages.
It works correct, but using this approach it would be more complicated task if I want to do that without complete the knowledge of page
(In my version users have the same html content, so I can apply these method).
All in all, I am looking for simpler solution (without neccessity of handling each event).
I had browsed about 50 webpages, articles and answers at Stack Overflow by now, but haven't found anything that talks about simpler solution
(My friend asked similar question, but there are only few answers).
I'm not interested in full solution, I hope that you give me some valuable hints or apparent links.
Maybe I didn't enter correct phrase...
Thank you for your help
Your question is most probably getting downvoted because it sounds malicious. Rather than asking a question with the word 'spying' in the title, I would use the word 'collaborate' instead. From what I just read above, it seems that what you want to do is work on the same screen as another client, not 'spy' on them.
Anyhow, to answer your question:
Have you come accross togetherJS before? This is a plugin which allows real time collaboration between 2 or more users. Your entire DOM actions will show up on a partner's screen, so you will no longer need to write event handler actions for each element within your DOM. The project is also hosted by mozilla, so you don't even have to host a realtime server yourself to make use of the plugin. Win!
There are some brilliant demos on the project webpage demonstrating the plugin's use. Check out the collaborative drawing demo for a simple, yet effective example.
As for actually integrating the plugin into your website, it couldn't be easier. Simply include the hosted script on your page like this:
<script src="https://togetherjs.com/togetherjs-min.js"></script>
Then initialise the plugin on your website. This can be done in a document ready event, or by using a button as you see in the example:
<button onclick="TogetherJS(this); return false;">Start TogetherJS</button>
Now when you want to start a collaboration session, simply invite another client to your page and you will both be able to see what happens on the page between both users in live time.
Hope this helps you out.
Is there a way to know the total time one spends on a page opened in a browser using a python script? For example if one uses gmail, and is currently using it (i.e the page is non idle) can we know the total time for which the page was active?
Further explaining what I intend to do:
By active means I am actually using the page, be it reading it,
doing some typing or doing some mouse work.
It would be great if there would somehow be a way to exclude the
time spent in breaks, perhaps introduce some error?
I am not sure whether javascript would be apt for it, and am open to suggestions!
Short answer: I don't think so.
This isn't really an issue of whether Python can do it, it's to do with whether your browser exposes that information in a way that an external program/script can query.
There's also the issue of how you define/determine which page is "active". Is it sufficient that the browser window is currently the active window and the page is on the selected tab? Or would you expect some kind of interaction? What if I'm reading a long text and so am not making interacting with the page for a period of time, does that still count as active?
The fact that it's hard to detect activity even from the website point of view, doing so from a 3rd party application/script be it written in Python or any other language would be even trickier.
If you wish to explore this further, I'd say your best bet would be to write a browser extension/plugin. In fact, there may already be existing ones that may meet your needs.
That sounds highly browser and platform-specific.
So, in general "no".
If the browser has some kind of interface or "hook" support then it might be possible.
This isn't really Python specific.
The best I can come up with is leave something like "Google Analytics" to do all that sort of stuff for you, then using your choice of language, get the data you need from the API
Of course that might not be appropriate, and the rules for how long it deems the page viewed, etc... may not work, but at least it'll be consistent.
I am trying to create a quiz on a web-page using HTML and JavaScript. Each question (having 4 options to choose from) is a seperate html file but uses the same JavaScript file to evaluate whether the choice entered is right or wrong.
However, I’m struggling to find a way to keep track of the number of correct answers provided by the users to calculate his/her score.
Is there a method to create static or static-like variables in JavaScript? Solutions involving cookies are also appreciated.
One possible solution is to load the HTML from your question file into a parent page, but have the whole quiz on that one page. That way, you still get the flexibility of having different pages for each question, but to the browser they are all one page. In addition, any variables created or traked in Javascript will persist throughout the entire quiz.
This is fairly easy to do with Jquery's .load function. You have a div in the middle of your page which loads its content from whichever HTML page you would have navigated to.
Do keep in mind that it is trivially easy for me to go into Javascript and change the number of correct answers. In fact, that problem exists for any client side solution. Should this be for more than fun, and accuracy is important, you may want to send results back to your server after each question. That way, no matter how you implement the quiz, results are persisted back on your end.
Have a look at http://www.electrictoolbox.com/jquery-cookies/
This allows you to easily set and read cookies.
You can keep the data in cookie. however an user may change the cookie and produce better result. Using session is a better choice in this scenario. because whatever you store in client side is unsafe.
However It is better to get the questions in json format with xhr and display them in browser and keep the track in memory
If you are developing a HTML5 application you may wish to investigate DOM storage facilities such as localStorage and sessionStorage: https://developer.mozilla.org/en-US/docs/DOM/Storage
Here are some useful resources / info:
http://ejohn.org/blog/dom-storage/
http://viralpatel.net/blogs/introduction-html5-domstorage-api-example/
http://msdn.microsoft.com/en-us/library/cc197062(v=vs.85).aspx
These days I would focus on making this a one-page app rather than relying on page loads. This not only has the advantage of solving your problem, it also means a more responsive, faster experience for the user.
If you must use page transitions, and you're happy to work with modern browsers only, look into localStorage. Far easier to use and more flexible than cookies - it works just like a serialised JavaSCript object.
I have implemented a requirement in my website where I can allow my end user to configure a link, to execute any javascript that he may require. Since, he can type in any javascript that he requires he also has the ability to open different web pages, create new pages via javascript, edit elements in the page via javascript and so on.
I have some security concerns over this functionality and would like to get some opinion from everyone. Is it possible that any malicious or unethical script could be added to the page that could bring about law and order problem or credibility issues? If so, is it possible to place in some code that would restrict the type of javascript that my user may add?
There's a thing called ADsafe which was developed for banner ads that is a strict subset of Javascript which is meant to prevent malicious code. I don't think you'd be able to do things like
open different web pages, create new pages via javascript, edit elements in the page via javascript and so on
though. I think you should re-think your needs, and try to determine if you can come up with a way to offer the ability for a user to choose from pre-determined code that you write, perhaps customizing it within certain bounds.
Then again, if you're absolutely sure that the javascript is only going to run for the user who entered it, there shouldn't be anything they can do that will screw it up for anyone else. If a user was determined he or she could simply inject their javascript in through other means, like a rewriting proxy or extension or simply the javascript console.