This project allows users to share a session report using the Web Share API. If the browser does not support sharing, it provides a fallback mechanism to copy the report text to the clipboard.
- 📤 Share via Web Share API (on supported browsers)
- 📋 Fallback to clipboard copy (if sharing fails or is unsupported)
- ⏳ Temporary success messages on button click
- HTML
- CSS
- JavaScript (Web Share API, Clipboard API)
- Clone this repository:
https://github.com/jeevanvishnu/Session-Report.git
- Hosting Link:
https://communicationsesionreport.netlify.app/
- Open
index.htmlin a browser to test the functionality.
- Enter your session report in the input field.
- Click the Share button:
- If supported, the browser’s native share dialog will appear.
- If unsupported, the report text will be copied to the clipboard.
- A success message will be displayed on the button temporarily.
- The
shareReport()function checks ifnavigator.shareis available:- If yes, it triggers the Web Share API.
- If no, it calls
fallbackShare()to copy the text.
fallbackShare()creates a temporarytextarea, copies the text, and removes it.- The share button updates its text temporarily to indicate success.
Feel free to fork this repo and submit a pull request with improvements!