Opened 8 years ago
Closed 6 years ago
#38255 closed enhancement (invalid)
inclusion of javascript script
Reported by: | nmoral | Owned by: | |
---|---|---|---|
Milestone: | Priority: | normal | |
Severity: | normal | Version: | 4.6.1 |
Component: | Script Loader | Keywords: | reporter-feedback |
Focuses: | Cc: |
Description
When I was working on my themes. I tried to include scripts with Javascript src wp but always include scripts with href.
I find class.wp-scripts.php always add base url to my src.
I think it is not good for two reasons:
1 - it is best to use for local javascript src scripts.
2 - I think it is not good practice to replace data theme because if developer wants src it is not good to add data without informing.
I think both solution can be imagined:
1 - just do not replace the data from themes
2 - allow possibility for developer to choose to add automaticly base_url for javascript.
Change History (3)
Note: See
TracTickets for help on using
tickets.
Hi @nmoral and welcome to Trac.
I'll be honest - I'm not 100% sure on what you're asking for here.
This has to be the expected behaviour, since all assets need to be referenced by absolute URL's, can you explain it with a example perhaps?
It simply builds a
<script>
tag based on the data a theme provides, once again, and example of what you get, and what you expect would greatly helpThe base_url for Javascript is always going to be the sites home_url, there's no really any way around that..