Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

livereload_script should use "protocol-relative URL" #66

Open
nulty opened this issue Mar 2, 2023 · 2 comments
Open

livereload_script should use "protocol-relative URL" #66

nulty opened this issue Mar 2, 2023 · 2 comments

Comments

@nulty
Copy link

nulty commented Mar 2, 2023

Description

def livereload_script():
if settings.DEBUG:
return format_html(
"""<script src="{}:{}/livereload.js"></script>""",

When this loads in my browser, the src populated with a relative URL path. The browser interprets this with the expectation that the path should be appended to the pages current URL.

The result is http://localhost:8000/127.0.0.1:35729/livereload.js which isn't going to work.

Proposal

By adding the relative protocol syntax, the browser can interpret the script src as a complete URI with an empty scheme. The scheme is inherited from the pages scheme.

 """<script src="//{}:{}/livereload.js"></script>""", 

Links

Protocol Relative URL

@nulty
Copy link
Author

nulty commented Mar 2, 2023

This is actually addressed in #61

@kbuilds
Copy link
Collaborator

kbuilds commented Jul 21, 2023

@nulty I don't think it was addressed. The change in #61 specifies the protocol to http. I like your proposal better.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants