Jump to content

How to shorten path reference to c:\......................*.js


vmars316
 Share

Recommended Posts

Hello & Thanks ,

I have an .html file here :

 

C:\Phaser\phaser-2.4.4\DownloadExamples\phaser-examples-master\examples\arcade-physics\asteroid-movement\asteroids-movement.html

 

that points to a .js file here :

 

<script src="C:\Phaser\phaser-2.4.4\DownloadExamples\phaser-examples-master\examples\lib\Phaser.js" type="text\javascript"><\script>
The prob for me is that the \lib Folder which contains the .js is not in the Path of .html .
Other than moving the \lib Folder , How can I shorten the Path reference to \lib\ Phaser.js ?

 

I suspect its some combination of ../examples/lib .

I have tried all kinds of combinations but I can't figure it out .

 

I need help .

Thanks...vmars

Link to comment
Share on other sites

You specify the path from the calling file to the target file. If both files are in the same folder then no path beyond the filename is necessary.

 

https://www.google.com/?gws_rd=ssl#q=relative+path

Thanks ,

I have been all around with google .

Some stuff contradicts other stuff .

Anyways , of the following 3 ways , only the first one works .

<script src="C:\Phaser\phaser-2.4.4\DownloadExamples\phaser-examples-master\examples\lib\Phaser.js" type="text/javascript"></script>
<!-- <script src="/examples/lib/Phaser.js" type="text/javascript"></script> -->
<!-- <script src="\examples\lib\Phaser.js" type="text/javascript"></script> -->
I must be missing something , help me out here .
Thanks
Link to comment
Share on other sites

Don't precede the path with a "/" because then it will be relative to the root of the computer.

 

Assuming the HTML file and the "examples/" directory are in the same location, this will work:

<script src="examples/lib/Phaser.js" type="text/javascript"></script>
Link to comment
Share on other sites

If the html file is...

 C:\Phaser\phaser-2.4.4\DownloadExamples\phaser-examples-master\examples\arcade-physics\asteroid-movement\asteroids-movement.html 

and the Javascript file is...

C:\Phaser\phaser-2.4.4\DownloadExamples\phaser-examples-master\examples\lib\Phaser.js

then this should work...

<script src="..\..\lib\Phaser.js"></script>  

or this...

<script src=".\..\..\lib\Phaser.js"></script>  
Link to comment
Share on other sites

 

If the html file is...

 C:\Phaser\phaser-2.4.4\DownloadExamples\phaser-examples-master\examples\arcade-physics\asteroid-movement\asteroids-movement.html 

and the Javascript file is...

C:\Phaser\phaser-2.4.4\DownloadExamples\phaser-examples-master\examples\lib\Phaser.js

then this should work...

<script src="..\..\lib\Phaser.js"></script>  

or this...

<script src=".\..\..\lib\Phaser.js"></script>  

Thank you very much guys !

Both this :

<script src="..\..\lib\Phaser.js"></script>

And this :

<script src=".\..\..\lib\Phaser.js"></script>

 

WORK !

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...