Hi,
I'm trying to get a jscript working so I can bookmark pages using weblink. Here's what I've tried, javacript:location.href='http://www.test.com/node/add/weblink?edit&url='+encodeURIComponent
(location.href)+'&title='+encodeURIComponent(document.title) but it fails.
Any ideas? I want to be able to grab the tilte and url.
Thanks,
Jim
| Comment | File | Size | Author |
|---|---|---|---|
| #2 | weblink-query.patch.txt | 1.39 KB | Egon Bianchet |
Comments
Comment #1
syscrusher commentedI'm not sure the forms library in Drupal will accept GET (rather than POST) parameters, but assuming it does, you need to check your variable names. The "edit" parameter is an array containing the others, so you need something like ..../weblink?edit['url']=http://www.example.com&edit['title']=This+is+my+title instead of having "edit" as a separate value-less parameter. You'll need to URLencode variable names like "edit['url']" of course. I don't have an ASCII chart handy to do that here.
Please let me know what you find when you try this. You may need to submit with a POST rather than a GET request.
Scott
Comment #2
Egon Bianchet commentedThis patch makes it work with a query string like this:
&title=title&url=url&description=descriptionThe description parameter is put into the body.
Many bookmarklets use this format, and above all it would work with my nodeformpopup module ;-)
Comment #3
Egon Bianchet commentedForget the patch, I'm going to use a form_alter in my module
Comment #4
Egon Bianchet commented