I was wondering how I could create a bookmarklet that would take someone's current location (href) and redirect to another page with the href as an "argument" to part of a new url. For example:

1. Someone goes to a webpage, decides to click on the bookmarklet.

2. The bookmarklet grabs the URL and then redirects to www.example.com/index.php?bookmarklet=URLFROMBOOKMARKLET

Is this possible? It sounds pretty easy, however, my strong point is definitely NOT JavaScript and I have no reason to learn it, except for this little project.

Let me know if you can help.

Regards,
Drew

Nevermind,

I was able to do this on my own by finding a few resources on the web. Here's what I came up with:

javascript:javascript:var baseURL ='http://www.example.com/';location.href=baseURL+'RESTOFTHEURLREDIRECT'

To get the current URL, you just use the following:

encodeURIComponent(location.href)

From there, you can concatenate that into your URL as an argument.

Regards,
Drew

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.