/    Sign up×
Community /Pin to ProfileBookmark

Site parameter/argument collection.

What is the command to use to view the parameters passed to a website?

Example, if ‘www.someSite.com?x=1&y=2&z=3’

I can split the URL at the ‘?’ character
and then split at the ‘&’ character
and finally split at the ‘=’ character
to get the key=value pairs of x=1, y=2, and z=3.

But how do I get the information passed starting at the ‘?’ character to begin?

to post a comment
JavaScript

4 Comments(s)

Copy linkTweet thisAlerts:
@KravvitzNov 26.2007 — Use [font="lucida console",monospace]location.search[/font]
Copy linkTweet thisAlerts:
@JMRKERauthorNov 26.2007 — Thank you 'Kravvitz' ?

While looking up your reference, 'location.search'

I also found I could use 'location.href'

Is there an advantage of using one over the other?

Thank you for your time.
Copy linkTweet thisAlerts:
@KravvitzNov 26.2007 — You're welcome ?

location.href contains the full URL.

location.search only contains the query string (including the "?") if there is one.
Copy linkTweet thisAlerts:
@JMRKERauthorNov 26.2007 — Thank you again.

That was most informative.

Short and too the point!
×

Success!

Help @JMRKER 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.29,
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,
)...