Trying to create a bookmarklet that asks/prompts the user for a URL parameter and outputs the value of the specified URL parameter as an alert message.
For example, given a URL, if you passes in name, the bookmarklet should output “Taylor”. If one passes in accountID, it should output “123456789”, and if email is passed then “tay@tc.com” should be outputted.
Example:
http://www.google.com/name=Taylor&accountID=123456789&email=jdoe@tc.com
Rules:
- This should work for ANY URL.
- It should use the current URL that the user is on.
- It should notify the user if there aren’t any URL parameters before asking/prompting the user for a parameter.
- Only xxxxx.js code.
Not sure how to even start this. Should I start by trying to build a search function or something like this:
(function (url, options) {
window.open(
encodeURIComponent(url),
options
);
}('http://www.google.com/name=Taylor&accountID=123456789&email=jdoe@tc.com','name, accountID, email'));