Aaron Quitta
Aaron Quitta

Reputation: 161

Web Browser is Adding Text to my HTML Link

So I'm working with this code:

<script>
var panel1 = Math.random()
</script>
<a href="//files.explosm.net/rcg/" target=_blank onclick="location.href=this.href+panel1+panel1+panel1+'.png';return false;">Repetitive Comic</a>

But whenever I click on "Repetitive Comic" I get sent to a url with the format of "file://files.explosm.net/rcg/*.png" which has an unexpected "files:" in front of it that I don't want. Is this something that my code is doing that I don't know about or is it my browser(Google Chrome)?

Upvotes: 1

Views: 92

Answers (1)

Jacob
Jacob

Reputation: 78850

You must be running this as a local HTML file, not accessed over HTTP. So any URL starting with:

//

...is going to inherit the same "protocol" as your local file, in this case file://.

Prepend http: or https: if you don't want file://

Upvotes: 3

Related Questions