Click here to Skip to main content
15,887,214 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
For this userscript I'm writing, I need to use a couple of third-party JavaScript libraries which have multiple JS files. Since @require doesn't work on Chrome, how can I add multiple external JS libraries to a userscript? I'm considering all the possibilities before choosing one.

I know you can add jQuery using this method. I have personally used that. But all my other code would have to run inside the main function of this code! I think that would be a problem when there are many libraries to work with.

Can you please suggest any other alternatives?

All your help is much appreciated. Thanks in advance.
Posted
Comments
Sergey Alexandrovich Kryukov 30-Dec-11 12:08pm    
Why? why all those tricks?!
--SA

1 solution

Why not using the simplest and most reliable method?

XML
<html>
<head>
    <title>...?<title>
    <script type="text/javascript" src="scripts/jquery-1.7.1.min.js"></script>
</head>
<body>

    <script type="text/javascript">
        //use JavaScript with jQuery here!
    </script>

<!-- ... -->

</body>
</html>


—SA
 
Share this answer
 
Comments
Isuru Nanayakkara 30-Dec-11 12:19pm    
I'm writing a userscript. Not a web page.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900