Beefy Boxes and Bandwidth Generously Provided by pair Networks
Don't ask to ask, just ask
 
PerlMonks  

Re^2: Mojolicious: Optional placeholder and template name

by frazap (Monk)
on May 21, 2019 at 10:12 UTC ( #11100304=note: print w/replies, xml ) Need Help??


in reply to Re: Mojolicious: Optional placeholder and template name
in thread Mojolicious: Optional placeholder and template name

Thanks for helping. I should be more specific:

The template common_js.html.ep (in ./templates) that load the js files is
<script src="monomapdata.js" type="text/javascript"></script> <script src="monomap.js" type="text/javascript"></script> <script src="utils.js" type="text/javascript"></script>
This works when I call http:// .... :3000/libmap, but not with :3000/fr/libmap If I change the src values to
<script src="../monomapdata.js" type="text/javascript"></script> <script src="../monomap.js" type="text/javascript"></script> <script src="../utils.js" type="text/javascript"></script>
:3000/fr/libmap works. But is it the right way to do this ?

Thanks

Replies are listed 'Best First'.
Re^3: Mojolicious: Optional placeholder and template name
by soonix (Canon) on May 21, 2019 at 10:23 UTC
    Did you try
    <script src="/monomapdata.js" type="text/javascript"></script>
    ?
      Yes ... That works too...

      How come ? Why ?

        • "monomapdata.js" (without leading slash) means "current directory"
        • "/monomapdata.js" (with leading slash) means "top directory"
Re^3: Mojolicious: Optional placeholder and template name
by Your Mother (Bishop) on May 21, 2019 at 14:23 UTC

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://11100304]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others pondering the Monastery: (6)
As of 2020-11-28 20:35 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found

    Notices?