Skip to content

Is it possible to url encode with mavo? #859

Answered by GalinhaLX
GalinhaLX asked this question in Q&A
Discussion options

You must be logged in to vote

the same way @LeaVerou is using on her demo:

html
<a property="url">[getWebsite(url)]</a>

_ & javascript_

function getWebsite(url) {
	return !!Mavo.value(url) ? new URL(url).host.replace(/^www\./, "") : "(Website)";
}

Isn't there a way to use the javascript function called encodeURIComponent() ?

Without knowing javascript I tried

function getWebsite(url) {
	return !!Mavo.value(url) ? new URL(url).host.encodeURIComponent() : "(Website)";
}

doesn't work, maybe it needs something between ( and )

Or is this a totally wrong way? :(

Replies: 5 comments 14 replies

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
11 replies
@GalinhaLX
Comment options

@DmitrySharabin
Comment options

@DmitrySharabin
Comment options

@WebMechanic
Comment options

@LeaVerou
Comment options

Answer selected by GalinhaLX
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
3 replies
@DmitrySharabin
Comment options

@LeaVerou
Comment options

@qorncat
Comment options

Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
6 participants