Skip to content
This repository has been archived by the owner on Jan 25, 2018. It is now read-only.

JS error will occur when using the URI constructor with a protocol handler like tel or mailto #5

Closed
kienD opened this issue Mar 25, 2017 · 3 comments
Milestone

Comments

@kienD
Copy link

kienD commented Mar 25, 2017

The maybeAddProtocolAndHostname_(opt_uri) method prepends the uri with http:// and then passes the value to the parse method which is trying to create a new URL(opt_uri) with the original protocol and the http//: protocol prepending it.

For example, if href="tel:123-123-1234" it will try to create a new URL(opt_uri) where opt_uri = "http://tel:123-123-1234".

This will cause the following JS error to occur:
Uncaught TypeError: Failed to construct 'URL': Invalid URL

As of now, I know that this is an issue for the following protocol handlers:

  • tel
  • mailto
  • skype

I ran into this issue while trying to utilize an anchor to navigate to an application via sennaJS.

@eduardolundgren
Copy link
Member

Make sense. Needs to add support for them. Could you please try to make the change? You can coordinate with @fernandosouza if you need help. Thanks.

@kienD
Copy link
Author

kienD commented Mar 27, 2017

Sure, I'll make the changes and send a pr.

@kienD kienD changed the title JS error will occur when when using the URI constructor with a protocol handler like tel or mailto JS error will occur when using the URI constructor with a protocol handler like tel or mailto Mar 27, 2017
kienD pushed a commit to kienD/metal-uri that referenced this issue Apr 10, 2017
SF
fixes deprecate#5
@jbalsas jbalsas modified the milestone: 3.0.0 Oct 19, 2017
@jbalsas jbalsas added this to the 3.0.1 milestone Oct 27, 2017
robframpton pushed a commit to robframpton/metal-uri that referenced this issue Oct 27, 2017
jbalsas added a commit that referenced this issue Nov 1, 2017
Add opt_addProtocol argument to Uri constructor for disabling default protocol. Fixes #5
@jbalsas
Copy link
Contributor

jbalsas commented Nov 1, 2017

Merged to develop and scheduled for 3.1.0 since we decided to add as an optional new feature rather than fix as a bug.

@jbalsas jbalsas closed this as completed Nov 1, 2017
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
3 participants