{"id":31580371,"url":"https://github.com/franbarinstance/bootstrap-5-modal-close-on-back","last_synced_at":"2026-05-03T07:36:08.635Z","repository":{"id":292867588,"uuid":"982204172","full_name":"FranBarInstance/bootstrap-5-modal-close-on-back","owner":"FranBarInstance","description":"Bootstrap close a modal with back button. A lightweight JavaScript utility that enhances Bootstrap 5 modals.","archived":false,"fork":false,"pushed_at":"2025-07-20T16:48:51.000Z","size":18,"stargazers_count":5,"open_issues_count":0,"forks_count":1,"subscribers_count":1,"default_branch":"master","last_synced_at":"2026-05-03T07:35:51.299Z","etag":null,"topics":["back-button","bootstrap","bootstrap-5-theme","bootstrap-modal","bootstrap-modals","bootstrap5","bootstrap5-modal","javascript-modal","js-modal","modal-bootstrap","modal-dialogs","modal-plugin","modals","popup-modal"],"latest_commit_sha":null,"homepage":"https://FranBarInstance.github.io/bootstrap-5-modal-dynamic/example/","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/FranBarInstance.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2025-05-12T14:24:09.000Z","updated_at":"2026-04-05T20:19:12.000Z","dependencies_parsed_at":null,"dependency_job_id":"b9a5e06c-48d2-44f5-804f-408a307e141f","html_url":"https://github.com/FranBarInstance/bootstrap-5-modal-close-on-back","commit_stats":null,"previous_names":["franbar1966/bootstrap-5-modal-close-on-back","franbarinstance/bootstrap-5-modal-close-on-back"],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/FranBarInstance/bootstrap-5-modal-close-on-back","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/FranBarInstance%2Fbootstrap-5-modal-close-on-back","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/FranBarInstance%2Fbootstrap-5-modal-close-on-back/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/FranBarInstance%2Fbootstrap-5-modal-close-on-back/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/FranBarInstance%2Fbootstrap-5-modal-close-on-back/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/FranBarInstance","download_url":"https://codeload.github.com/FranBarInstance/bootstrap-5-modal-close-on-back/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/FranBarInstance%2Fbootstrap-5-modal-close-on-back/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":32562118,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-03T06:36:36.687Z","status":"ssl_error","status_checked_at":"2026-05-03T06:36:09.306Z","response_time":103,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["back-button","bootstrap","bootstrap-5-theme","bootstrap-modal","bootstrap-modals","bootstrap5","bootstrap5-modal","javascript-modal","js-modal","modal-bootstrap","modal-dialogs","modal-plugin","modals","popup-modal"],"created_at":"2025-10-05T21:11:24.964Z","updated_at":"2026-05-03T07:36:08.600Z","avatar_url":"https://github.com/FranBarInstance.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Bootstrap 5 Modal Close on Back Button\n\nA lightweight JavaScript utility that enhances Bootstrap 5 modals to close modals when browser back button is pressed.\n\nIt can be used in combination with: [modal dynamic](https://github.com/franbarinstance/bootstrap-5-modal-dynamic)\n\n## Features\n\n- **Close a bootstrap modal with back button**\n- **Preserves all native** Bootstrap modal functionality\n- **No conflicts** with existing modal implementations\n- No jquery dependency\n- No dependencies other than Bootstrap 5\n- Lightweight (~1KB minified)\n- No additional configuration needed - works out of the box!\n\n## Installation\n\n### Via CDN\n\n```html\n\u003cscript src=\"https://cdn.jsdelivr.net/gh/franbarinstance/bootstrap-5-modal-close-on-back@0.0.1/src/modal-close-on-back.min.js\"\u003e\u003c/script\u003e\n```\n\n### Download\n\nDownload the script from GitHub repository: [close on back button](https://github.com/franbarinstance/bootstrap-5-modal-close-on-back) and include in your HTML:\n\n```html\n\u003cscript src=\"path/to/modal-close-on-back.min.js\"\u003e\u003c/script\u003e\n```\n\n## Usage\n\nSimply include the script after Bootstrap 5 - no additional configuration needed. You can add the script to your current html without making any changes at all.\n\n### See: [DEMO](https://franbarinstance.github.io/bootstrap-5-modal-dynamic/example/)\n\n### Modal example\n\n```html\n\u003cbutton type=\"button\" class=\"btn btn-primary\" data-bs-toggle=\"modal\" data-bs-target=\"#modalExample\" \u003e\n    Open modal\n\u003c/button\u003e\n\n\u003cdiv class=\"modal fade\" id=\"modalExample\" tabindex=\"-1\" aria-labelledby=\"modalExampleLabel\" aria-hidden=\"true\"\u003e\n    \u003cdiv class=\"modal-dialog\"\u003e\n        \u003cdiv class=\"modal-content\"\u003e\n            \u003cdiv class=\"modal-header\"\u003e\n                \u003ch1 class=\"modal-title fs-5\" id=\"modalExampleLabel\"\u003eClose modal on back button\u003c/h1\u003e\n                \u003cbutton type=\"button\" class=\"btn-close\" data-bs-dismiss=\"modal\" aria-label=\"Close\"\u003e\u003c/button\u003e\n            \u003c/div\u003e\n            \u003cdiv class=\"modal-body\"\u003e\n                You can click the Back Button to close this modal.\n            \u003c/div\u003e\n            \u003cdiv class=\"modal-footer\"\u003e\n                \u003cbutton type=\"button\" class=\"btn btn-secondary\" data-bs-dismiss=\"modal\"\u003eClose\u003c/button\u003e\n            \u003c/div\u003e\n        \u003c/div\u003e\n    \u003c/div\u003e\n\u003c/div\u003e\n\n\u003cscript src=\"https://cdn.jsdelivr.net/gh/franbarinstance/bootstrap-5-modal-close-on-back@0.0.1/src/modal-close-on-back.min.js\"\u003e\u003c/script\u003e\n```\n\n## How It Works\n\nThis is a lightweight JavaScript utility that enhances Bootstrap 5 modals by allowing them to close when the user clicks the browser's Back button .\n\nBrowsers do not automatically close modals when the back button is pressed. This utility adds that behavior to make your application more intuitive and consistent with user expectations. Especially if it is a PWA for mobile devices.\n\n### What it does\n\nIf the user clicks the close button in the modal, the browser goes back one step in the history using window.history.go(-1).\n\nIf the user presses the browser's back button (hashchange event), the utility detects this and closes the last open modal.\n\n## Contributing\n\nWe welcome contributions to this project. If you have suggestions for improvements or want to report issues, please create an issue or submit a pull request.\n\n1. Fork the repository.\n2. Create a new branch for your feature or bug fix.\n3. Make your changes.\n4. Submit a pull request.\n\n## License\n\nThe MIT License (MIT)\n\nCopyright © 2025 github.com/FranBarInstance\n\nPermission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffranbarinstance%2Fbootstrap-5-modal-close-on-back","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ffranbarinstance%2Fbootstrap-5-modal-close-on-back","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffranbarinstance%2Fbootstrap-5-modal-close-on-back/lists"}