Brian Rollins – Author jsParam – URL Params via SCRIPT Tag

jsParam – URL Params via SCRIPT Tag

Ever wanted to load URL params directly from the SRC attribute in your <script> tag? Now you can with jsParam. It does not require any other libraries (like jQuery) to run.

Pass parameters like you would in PHP/ASP/JSP:

<script src=”somefile.js?menu=true&color=green&count=42″ id=”somefile”></script>

Updated May 2, 2016: Now allows you to pass arrays as well as strings, booleans, and numbers.

jsParam GitHub Repository

[snippet id=”4″]

1 thought on “jsParam – URL Params via SCRIPT Tag”

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.