A simple random quote generator that fetches quotes from an API and allows users to copy, tweet, and save them as an image.
Click here to view the website
- Fetch Random Quotes: Retrieves a new quote from an API.
- Copy Quote: Allows users to copy the quote to the clipboard.
- Tweet Quote: Shares the quote on Twitter (X).
- Save Quote as Image: Converts the quote into an image and downloads it.
- HTML, CSS, JavaScript
- FreeAPI for quotes
- html2canvas (for saving quotes as images)
-
Fetching Quotes
- The
fetchDatafunction retrieves a random quote fromhttps://api.freeapi.app/api/v1/public/quotes/quote/random. - The
displayQuotefunction updates the UI with the fetched quote and author.
- The
-
User Interactions
- Clicking "New Quote" fetches another random quote.
- "Copy to Clipboard" copies the quote text.
- "Share on Twitter" opens Twitter with the quote pre-filled.
- "Save as Image" uses
html2canvasto generate an image of the quote.
- Clone the repository:
git clone https://github.com/imaaryan/Random-Quote-Website.git
- Open
index.htmlin your browser.
Feel free to submit a pull request if you'd like to improve the project!
This project is open-source and available under the MIT License.
