Click here to Skip to main content
Full site     10M members (44.2K online)    

JavaScript for Bookmark Login

Introduction

This code has been designed to list all the Tags on a web page that have an Id and then allow the user to select that element and enter a value that should be inserted into that element's value.  A JavaScript is then generated that can be pasted in to a bookmark URL to enable one click entry in to most websites.
Starting with a basic single entry code for updating the Username / ID, I have updated the code to allow multiple Input field updating and drilling down 2 layers of iFrame.  Tested on the Pizza Express Voucher entry field, I felt this addition to be of some benefit.

Background

As a lot of my time between contracts is spent job searching, I visit a lot of Job Search web sites. Some of my contracts span over 2 to 3 years and trying to remember all the Login Ids for all the websites can be a bit mind blowing.

In my recent job search activity, I have tried to protect my own software developments by limiting my PC's Internet presence and opting for the use of my iPhone and or iPad, with the occasional need of my Nokia N810 whenever a non image file needs to be uploaded.

Using the Code

The code below can be pasted into a browser bookmark using the following method:

 
javascript:
    var a,b,c,d,e="",f,g="",h,i;
    a=document.getElementsByTagName('*');
    for(f=0;f<77;f++){
        getEl();
        if(c>0){
            d=prompt("Please give me the value for "+a[c].id+"!");
            g=g+e+"document.getElementById('"+a[c].id+"').value='"+d+"';";
            a[c].value=d;
            if(prompt("Update another Element in this selection?  Y=Yes, N=No!","n").toLowerCase()=="n"){
                prompt("Use this script!","javascript:"+g);
                f=77;
            }
        }
    } 
function fndEl(a){
    for(i=0;i<a.length;i++){
        if(!a[i].id||a[i].id==""){}
        else{
            b=b+i+") "+a[i].id+" = "+a[i].value+" "+a[i].tagName+"\n";
        }
    }
}
function getEl(){
    b="";
    c=0;
    d="";
    fndEl(a);
    c=prompt(b);
    if(a[c].tagName=="IFRAME"||a[c].tagName=="FRAME"){
        e="document.getElementById('"+a[c].id+"').contentWindow.";
        a=a[c].contentWindow.document.getElementsByTagName('*');
        b="";
        fndEl(a);
        if(b!=""){
            c=prompt(b);
            if(a[c].tagName=="IFRAME"||a[c].tagName=="FRAME"){
                e=e+"document.getElementById('"+a[c].id+"').contentWindow.";
                a=a[c].contentWindow.document.getElementsByTagName('*');
                b="";
                fndEl(a);
                if(b!=""){
                    c=prompt(b);
                }
            }
        }
    }
}

Please note that the 1st version of this code was written using the Note App on iPad and tested using the Safari iPad browser.  The current version has be written using the iPad App jsAny and again tested with the iPad Safari browser.
Please do not use this code to save passwords, as bookmarks do not encrypt the data!

 
Hint: For improved responsiveness ensure Javascript is enabled and choose 'Normal' from the Layout dropdown and hit 'Update'.
You must Sign In to use this message board.
Search 
Per page   
SuggestionDevelopment
IPI Paul
5 Apr '13 - 9:17 

Last Updated 7 Apr 2013 | Advertise | Privacy | Terms of Use | Copyright © CodeProject, 1999-2013