I'm currently developing a userscript that could be in use for a few years after I've left the company. The target audience has basic computer literacy--enough to fill out a simple configuration menu.
I worry that the scripts could break because the IT department could move the webpages I have listed in the @include
. I can document how to fix the scripts, but I want to defensively program against IT departments that I know are incredibly incompetent. I know I can do the following:
- Allow the user to specify URLs in a configuration page.
- Set the
@include
to be very generic ashttps://*.edu/*
and use anif
statement to determine we're on the user-specified URL usingwindow.location.href
before executing commands.
A few concerns about this solution: I want the script to be easily reusable between institutions, which is why I have the *.edu
mentioned instead of specificschool.edu
. The above configuration would have the script execute on literally every page of any .edu
website, but the actions would only occur if they're on the webpage due to the if
statement. This seems horribly inefficient, but I understand this may be a tradeoff between ease of portability for efficiency.
Is there any better way to do this?