What is the right way to write my script 'src' url for a local development environment?

Spilot picture Spilot · May 21, 2013 · Viewed 118.6k times · Source

I'm working on a local environment and I'm not sure if I've written my src URl correctly because my functions aren't working. The bold script tag has the src in question.

<!DOCTYPE html>
<html>
    <head>
    <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.9.0/jquery.min.js"></script>
    <script src="http://www.parsecdn.com/js/parse-1.2.2.min.js"></script>

    **<script src="/Users/myUserName/Desktop/myPage.js"></script>**

    </head>
    <body>
        <div id="mainDiv">
            <p><a href="#">anchor</a></p>
        </div>
    </body>
</html>

Answer

ARC picture ARC · May 24, 2013

Write the src tag for calling the js file as

<script type='text/javascript' src='../Users/myUserName/Desktop/myPage.js'></script>

This should work.