How to "Decompile" a Bookmarklet?

We all know that bookmarklets are nothing but some executable javascript code that do some things for us when we click on them depending on the function that they are intended to do... My Question is:

For example, I have a Bookmarklet, don't know, something like this one:

javascript:void(window.open('http://www.pdfdownload.org/web2pdf/Default.aspx?left=0&right=0&top=0&bottom=0&page=0&cURL='+document.location.href));

As far as I understand, the bookmarklet code (with the "&cURL=" thing) takes the URL that is in the adress bar of the browser and then do something with it in order to get a result. Something similar can be done with a selection, by changing some parameters in the bookmarklet (Like with the "Search selection in Google Maps" one) and some others.

How can I "decompile" a bookmarklet in order to make it take the desired data (in this case an URL) from a form?

For example, let's say I want to use the above bookmarklet in a webpage to provide a form that let's the user input a URL and then click a button to get the result.

I've seen other bookmarklets that get the URL from a "?input=" and others from a "?url="

How can I pass bookmarklet's functions to a form?

-------------Problems Reply------------

In a bookmarklet it's actually easiest to use prompt('Please enter a URL', 'default value') instead of the variable. Displaying a form in the current webpage is rather cumbersome.

If you just need one user-entered value, prompt() is an easy to use alternative to ask a user for more info. (Of course you can use multiple prompt() calls, too, but this will probably lead to a confused user)

Try something like this:

<form method="get" action="http://www.pdfdownload.org/web2pdf/Default.aspx">
<input type="hidden" name="left" value="0">
<input type="hidden" name="right" value="0">
<input type="hidden" name="top" value="0">
<input type="hidden" name="bottom" value="0">
<input type="hidden" name="page" value="0">
<input type="text" name="cURL">
<input type="submit">
</form>

Maybe you can call a javascript file in your bookmarklet :

javascript:void((function(){var%20e=document.createElement('script');e.setAttribute('type','text/javascript');e.setAttribute('src','http://www.example.com/js.js');document.body.appendChild(e)})())

And you create an iframe on js.js

var site = location.href;
document.body.innerHTML += "<div style='background-color:white;z-index:1000;position:fixed;right:0;top:0' width='300' height='250'><iframe src='http://www.example.com/bookmarklet.php?q=" + site + "' /></div>";

Category:javascript Views:2 Time:2011-01-21

Related post

  • Http Auth in a Firefox 3 bookmarklet 2008-08-07

    Im trying to create a bookmarklet for posting del.icio.us bookmarks to a seperate account. I tested it from the command line like: wget -O - --no-check-certificate \ "https://seconduser:[email protected]/v1/posts/add?url=http://seet.dk&

  • What types of executables can be decompiled? 2008-09-04

    I think that java executables (jar files) are trivial to decompile and get the source code. What about other languages? .net and all? Which all languages can compile only to a decompile-able code? --------------Solutions------------- In general, lang

  • Free Python decompiler that is not an online service? 2008-09-07

    Is there a library or application that can decompile Python 2.4+ bytecode to obtain the source code? A search revealed: http://depython.net - an online service that you need to upload a pyc or pyo file to the dis module - allows you to disassemble, b

  • How to lock compiled Java classes to prevent decompilation? 2008-09-08

    How do I lock compiled Java classes to prevent decompilation? I know this must be very well discussed topic on the Internet, but I could not come to any conclusion after referring them. Many people do suggest obfuscator, but they just do renaming of

  • How to display a form in any site's pages using a bookmarklet (like Note in Google Reader)? 2008-09-15

    In Google Reader, you can use a bookmarklet to "note" a page you're visiting. When you press the bookmarklet, a little Google form is displayed on top of the current page. In the form you can enter a description, etc. When you press Submit, the form

  • How can you find all the IP addresses in a selected block of text with a javascript bookmarklet? 2008-09-16

    I am just starting to learn javascript, so I don't have the skills to figure out what I assume is a trivial problem. I'm working with a Wordpress blog that serves as a FAQ for our community and I am trying to pull together some tools to make managing

  • How do you decompile a swf file 2008-09-18

    I am the maintainer of a site that has allegedly 'lost' the source code to a flash swf file. How do I decompile this source? Are there any programs online or offline that I could use? --------------Solutions------------- This can also be done freely

  • Load external JS from bookmarklet? 2008-09-19

    How can I load an external Javascript file using a bookmarklet? This would overcome the URL length limitations of IE and generally keep things cleaner. --------------Solutions------------- Use a bookmarklet that creates a script tag which includes yo

  • BAML Decompiler / Viewer 2008-09-22

    Could anyone recommend a good BAML Decompiler / Viewer besides BAML Viewer plugin for Reflector, which doesn't handle path geometry/data? --------------Solutions------------- You might like to have another look at the BAML addin for reflector as it's

  • How do I detect a keyboard modifier in a bookmarklet? 2008-09-26

    Is there a way to detect if the user is holding down the shift key (or other modifier keys) when executing a javascript bookmarklet? In my tests of Safari 3.1 and Firefox 3, window.event is always undefined. --------------Solutions------------- If yo

  • JavaScript bookmarklet to delete all cookies within a given domain 2008-10-07

    I am testing a web app that writes cookies to subdomain.thisdomain.com and several subfolders within that. I'm looking for JavaScript that I can put into a bookmarklet that will delete all cookies under that subdomain, regardless of the folder in whi

  • How do I decompile a .NET EXE into readable C# source code? 2008-10-07

    I wrote a C# application for a client a couple of years ago, but I no longer have the source code. All I have is the EXE that I deployed on the client's PC. Is there a way I can generate C# source code from the EXE? --------------Solutions-----------

  • What's a good C decompiler? 2008-10-11

    I am searching for a decompiler for a C program. The binary is a 32-bit x86 Linux executable. Objdump works fine, so basically I am searching for something which attempts to reconstruct the C source from the asm source. --------------Solutions-------

  • Best (free?) decompiler for C# with Visual Studio integration? 2008-10-18

    In my Java development I have had great benefit from the Jad/JadClipse decompiler. It made it possible to know why a third-party library failed rather than the usual guesswork. I am looking for a similar setup for C# and Visual Studio. That is, a set

  • .NET decompilation, how easy is it? 2008-11-05

    I was looking into the best encryption for a license key for an application, and someone said that someone can easily decompile the application and then just skip the test for the license key. how would someone go about doing that practically speakin

  • How do I "decompile" Java class files? 2008-11-07

    What program can I use to decompile a class file? Will I actually get Java code, or is it just JVM assembly code? On Java performance questions on this site I often see responses from people who have "decompiled" the Java class file to see how the co

  • Is it possible to "decompile" a Windows .exe? Or at least view the Assembly? 2008-11-07

    A friend of mine downloaded some malware from Facebook, and I'm curious to see what it does without infecting myself. I know that you can't really decompile an .exe, but can I at least view it in Assembly or attach a debugger? Edit to say it is not a

  • Is there a program to decompile Delphi? 2008-12-02

    Someone just sent me a decompile of a program into C. It was a very good decompile, producing nice, mostly readabe C code (if you overlook the fact that none of the variables or functions had a human-readable name) that mostly looked like it would ac

  • Decompiling and Redistributing Abandonware 2008-12-15

    Is it actually legal to download proprietary programs available from "abandonware" websites such as http://www.abandonia.com? Furthermore, If decide to decompile a program obtained from such a website, with a tool such as Boomerang, would I be able t

Copyright (C) dskims.com, All Rights Reserved.

processed in 0.126 (s). 11 q(s)