ampproject / ampproject/amphtml
amp-script: Support location.href (don't return the blob URL)
- Dominant language
- JavaScript
- Stars
- 14.9k
- Forks
- 4.1k
- PR merge metrics
- No merged PRs in 30d
Description
I am using AMP-SCRIPT. I want to get the current URL with parameter, but that what I get:
```
blob:http://localhost:8080/bcd8ce8b-4c8f-4ab0-8d4e-471d7be9af3f
```
That's what I want:
```
http://localhost:8080/?foo=bar
```
The HTML code:
```
AMP-SCRIPT
{
"@context": "http://schema.org",
"@type": "NewsArticle",
"headline": "Article headline",
"image": ["thumbnail1.jpg"],
"datePublished": "2015-02-05T08:00:00+08:00"
}
body {
-webkit-animation: -amp-start 8s steps(1, end) 0s 1 normal both;
-moz-animation: -amp-start 8s steps(1, end) 0s 1 normal both;
-ms-animation: -amp-start 8s steps(1, end) 0s 1 normal both;
animation: -amp-start 8s steps(1, end) 0s 1 normal both;
}
@-webkit-keyframes -amp-start {
from {
visibility: hidden;
}
to {
visibility: visible;
}
}
@-moz-keyframes -amp-start {
from {
visibility: hidden;
}
to {
visibility: visible;
}
}
@-ms-keyframes -amp-start {
from {
visibility: hidden;
}
to {
visibility: visible;
}
}
@-o-keyframes -amp-start {
from {
visibility: hidden;
}
to {
visibility: visible;
}
}
@keyframes -amp-start {
from {
visibility: hidden;
}
to {
visibility: visible;
}
}
body {
-webkit-animation: none;
-moz-animation: none;
-ms-animation: none;
animation: none;
}
Hello amp-script!
```
javascript.js
```
const btn = document.querySelector('button');
btn.addEventListener('click', () => {
document.body.textContent = location.href;
});
```
Contributor guide
Assessment
This issue has not been assessed yet.