// Loading...
Copy the entire code into a new file called, for example, quizmaster.html.
Open that file with any modern browser (Chrome, Edge, Firefox, etc.).
The quiz app loads immediately – all features are available offline after the first load.
Note about
uploads/quiz.json
This is a pure front‑end application, so custom quizzes are stored in your browser’s localStorage, not in a server folder. You can still upload a.jsonfile or paste JSON directly – the app will remember them automatically.
The app has four main views accessible from the top navigation bar:
| View | What it does |
|---|---|
| Home | Hero section + list of all available quizzes (default + your custom ones). |
| Add Quiz | Interface to create a new quiz by pasting or uploading JSON. |
| Quiz Player | Appears when you click Start Quiz. Shows questions, timer, options, and feedback. |
| Results | Displays after finishing a quiz: score, statistics, answer review. |
Use the mobile menu button (three horizontal lines) on small screens.
At the end of any quiz, you can Retry, Review Answers, or go back to Home.
Even though there’s no physical uploads/ folder, you can add as many quizzes as you like. Here’s how:
Click “Add Quiz” in the nav bar.
Write (or copy‑paste) a quiz in JSON format into the text area.
Click “Save Quiz”.
The quiz instantly appears on the Home screen under Available Quizzes.
.json fileOn the Add Quiz page, click the upload area (or drag & drop a .json file onto it).
The content of the file fills the text area.
Review the JSON, then click “Save Quiz”.
Click the “Load Sample” button to see the required JSON structure, then modify and save.
Important: All saved custom quizzes persist in your browser’s localStorage. They stay even after closing the tab, but they are lost if you manually clear your browser data.
Your custom quiz must follow this structure (same as the sample):
{ "title": "My Awesome Quiz", "category": "General", "difficulty": "medium", "timePerQuestion": 25, "iconType": "custom", "questions": [ { "question": "What is the capital of France?", "options": ["London", "Berlin", "Paris", "Madrid"], "correct": 2, "explanation": "Paris is the capital of France." }, { "question": "How many continents are there?", "options": ["5", "6", "7", "8"], "correct": 2, "explanation": "There are 7 continents." } ] }
Rules:
title – string, required.
questions – array of objects, at least one question.
Each question must have:
question (string)
options (array of strings, minimum 2 options, maximum 4 recommended)
correct (integer 0‑based index of the correct option)
explanation (string, optional but recommended)
Optional fields: difficulty (easy/medium/hard), timePerQuestion (seconds, default 30), iconType (science/general/tech/custom).
Timer per question – default 30 seconds (customisable via JSON). Bar turns yellow then red as time runs out.
Keyboard shortcuts – while a question is active, press 1‑4 or A‑D to select an answer. Press Enter or Space to move to the next question after answering.
Instant feedback – after selecting an answer, the correct option is highlighted in green, wrong ones in red, and an explanation appears.
Scoring – points for each correct answer: 100 + (time left * bonus). Perfect scores trigger confetti.
Results screen – shows percentage, total points, time taken, and a question‑by‑question review.
If you want to change the default quizzes or the behaviour:
Edit the pre‑loaded quizzes – Find the defaultQuizzes array in the JavaScript (around line 1500). Add, remove, or modify quiz objects.
Change default timer – Inside each quiz object, set timePerQuestion to your preferred number.
Adjust styling – All colours are CSS custom properties under :root. For example, change --accent-1 to a different colour to rebrand the app.
uploads/quiz.json folder?The current implementation is fully client‑side. If you later need to store quizzes on a server (e.g., with Node.js or Python), you would:
Send the JSON from the Add Quiz page to an endpoint that saves it in uploads/quiz.json (or multiple files).
Load those files on startup instead of using localStorage.
However, for most personal or demo use, the localStorage approach is simpler, faster, and already implemented. The app shows exactly the same “upload” experience without any backend.
HTML5, CSS3, JavaScript
This Quiz App is built using HTML5, CSS3, and JavaScript without any external frameworks.
Yes, the application is fully responsive and works smoothly on mobile phones, tablets, and desktop devices.
Yes, users can answer multiple-choice questions and receive instant feedback and scoring.
Yes, developers can easily modify questions, answers, categories, and quiz settings according to their requirements.
Yes, the Quiz App automatically calculates scores and displays the final result after quiz completion.
Yes, this project is suitable for educational platforms, online tests, practice exams, and learning applications.
Navigate to the 'Add Quiz' section. You can either paste your quiz as a JSON object directly into the text area, or upload a .json file using the drag-and-drop area. Click 'Save Quiz' and it will instantly appear on the home screen.
Each question has a configurable time limit (default 30 seconds). A progress bar shows remaining time; it turns yellow when 10 seconds are left and red in the last 5 seconds. If time runs out, the question is marked incorrect automatically.
Points are awarded only for correct answers. The base score is 100 points, plus a bonus proportional to the remaining time. Total points and a percentage score are shown at the end, along with a detailed answer review.
Yes. During a question, press 1, 2, 3, or 4 (or A, B, C, D) to select an option. After answering, press Enter or Space to move to the next question.
Custom quizzes are saved in your browser's localStorage. They remain even after closing the tab, but are lost if you clear your browser data. No server upload is required.
Yes, two built-in quizzes are included: 'Science & Technology' (5 questions, medium difficulty) and 'General Knowledge' (5 questions, easy difficulty). You can start playing immediately without adding anything.