Script Tag Data
Set and read data from a <script>
tag
Installation
Bower
$ bower install script-tag-data --save
CDN
Usage
Provide the user / app a simple <script>
tag, a CSS #id
and whatever data points as HTML5 data
attributes.
- Get all of the data values from a
<script>
tag:ScriptTagData.getData(scriptId)
- Only get the
<script>
tag:ScriptTagData.getScript(scriptId)
Examples
Some website with your <script>
tag, an ID and the desired data points.
Title ...
Your JS file where you have ScriptTagData library loaded by either referencing from here on GitHub or serving it yourself.
/** * This returns the following: * * { * car: 'pagani', * starRepo: 'yes, please :)' * } */ ScriptTagData; /** * This returns the juust <script> tag */ ScriptTagData;
Questions
Please use issues page for any questions or concerns.