简体   繁体   中英

How can I specify codes to different pages with same JS file

In my project i have an authetication Js that has to handle user signIN and registration. But it has code lines that should affect other pages and leave some. How can I specify which code on index.html, chats.html etc so that whenever a user is logged in each page loaded has its own changes.

It should be other way around.

Instead of defining your logic in one file asking for current URL, you can apply separate code (file?) to each HTML page. Your authentication code should allow to inject behavior after the user gets authenticated and some other situations.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM