ampproject / ampproject/amphtml
Support file:/// as prefix in addition to localhost
- Dominant language
- JavaScript
- Stars
- 14.9k
- Forks
- 4.1k
- PR merge metrics
- No merged PRs in 30d
Description
## Describe the new feature or change to an existing feature you'd like to see
Currently if you have AMP files on disk, it checks that relative URLs start with http:// or localhost - you cannot use file:/// as a prefix. This means if you have files on disk, say checked out from a git repo, you cannot test those files by opening them directly in chrome. You have to spin up a web server to try out your AMP page (web story in my case).


I would like to create a debug AMP pages without having to start up a web server.
## Describe alternatives you've considered
I check my code out using git. Spinning up a web server inside the checkout git directory feels like an overkill. I just want to open the web page with all the images, videos etc it references in the same directory using relative paths. This does not work because the original HTML page was opened using a file:/// prefix (I am on Windows).
What I instead do is push the changes to GitHub and use it as my web server, but it means I have to commit and push as part of my debugging process, which feels wrong. It also causes caching problems as my changes are not published immediately.
Contributor guide
Research direction
Start by locating the AMP validation that currently accepts relative URLs only with http:// or localhost, then reproduce the behavior by opening an AMP file directly in Chrome with a file:/// URL. Done means local AMP pages accept file:/// as a valid prefix and their relative images, videos, and other resources work without a web server.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript
- Domain
- frontend, web-dev
- Issue type
- Feature
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100