0

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

1
Contributor
1
Reply
2
Views
8 Years
Discussion Span
Last Post by drewrockshard
0

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

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.