/    Sign up×
Community /Pin to ProfileBookmark

Dynamic URL based on URL and current HREF

I have a html page that contains links in this format: `<a href=”ref123.htm”></a>`.
I would like to have a script to point the visitor to a different link based on the following criteria: If the URL where file is located contains `2004` AND if `a href` contains`ref123.htm`, then change it to `ref567.htm`.

to post a comment
JavaScript

2 Comments(s)

Copy linkTweet thisAlerts:
@JMRKERMar 06.2020 — Is this some sort of bait-and-switch request?

Why would you change the operator's initial request on a link to another location?
Copy linkTweet thisAlerts:
@jcmaadauthorMar 09.2020 —  I just discovered that depending on which folder the documents sits, it supposed to point to a different folder. For example, one document if it sits in 2004 folder then links in should point to one URL, if the same doc sits in 2005 folder then the link points to a different link.
×

Success!

Help @jcmaad spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 4.23,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,

tipper: @Samric24,
tipped: article
amount: 1000 SATS,
)...