Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Jquery conflict being duplicated on the page with the toast #35

Open
CristyanHenrich opened this issue Mar 26, 2023 · 4 comments
Open

Comments

@CristyanHenrich
Copy link

CristyanHenrich commented Mar 26, 2023

Describe the bug
The bug consists of duplicating the page's jQuery if it already has an imported jQuery script, after toastr's popup returns.

To Reproduce
Steps to reproduce the behavior:

  1. Import cdn from jQuery in a page
  2. Have a jquery code on that page. in my example I had jQuery to control the opening and closing of a modal.
  3. Create a route to leave this page and return to it by displaying the popup in my example I had a modal to confirm the deletion of a user where it returned to that same page after being deleted.
  4. In the inspect element you will see that the jquery is again imported via cdn by a file called flasher.min.js. Thus preventing the modal from being controlled by jquery again because it is duplicated.

Expected behavior
It is expected that jQuery will stop working due to duplicate imports.

Desktop (please complete the following information):

  • OS: iOS 10.15.7 Catalina
  • Browser Firefox
  • Laravel 9

Additional context

  • toastr v2.3.0
@yoeunes
Copy link
Owner

yoeunes commented Mar 27, 2023

Hello @CristyanHenrich, thank you for reporting the issue and for your patience. I apologize for any inconvenience caused by the lack of documentation on this matter.

To resolve this issue, please follow these steps:

Publish the configuration file by running the command: php artisan vendor:publish --tag="flasher-toastr-config".
This will publish the configuration file to the config/flasher_toastr.php location.

Remove the jQuery CDN line from the configuration file that was just published. This step will prevent the package from automatically loading the jQuery CDN.

After completing these two steps, the issue should be resolved. Please note that yoeunes/toastr uses PHPFlasher under the hood.

I hope this helps. Please let me know if you have any further questions or concerns. Thank you for using yoeunes/toastr package, and for your contribution in reporting this issue.

@zain-qayyum
Copy link

how to remove jquery CDN in 2.0 version?

this command is not working on this version -- php artisan vendor:publish --tag="flasher-toastr-config"

@yoeunes
Copy link
Owner

yoeunes commented Apr 15, 2023

Hi @zain-qayyum, can you run the following command instead: php artisan flasher:install this will publish the configuration files related to PHPFlasher, and then you can remove the jQuery CDN line.

@SmSmBeRo
Copy link

toaster cdn not working in egypt and try to call

<script src="https://www.unpkg.com/@flasher/[email protected]/dist/flasher.min.js"></script>

also not working

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants