Sending message on load

F

Francis Lewis

Hi there - I have a need for a page to pop up a user/password dialogue
when it loads and for the user/password that they enter to be sent to
be logged somewhere on the server. The underlying page then loads as
normal. Does anyone have an idea about how I might do this?
 
L

Lasse Reichstein Nielsen

Hi there - I have a need for a page to pop up a user/password dialogue
when it loads and for the user/password that they enter to be sent to
be logged somewhere on the server. The underlying page then loads as
normal. Does anyone have an idea about how I might do this?

Use HTTP authentication instead of doing it in Javascript. How to do that
depends on the web server (I believe Apache uses the .htaccess file).

If you want to log it on the server, you will most likely need

If you insist on using Javascript, you must either create the interface
yourself, or use two prompt's.

function formEncode(s){
return escape(s.replace(/ /g,"+"));
}

function bugUser() {
var user = formEncode(prompt("Username:"));
var passwd = formEncode(prompt("Password:"));
var dummy = new Image():
dummy.src = "noImage.png?user="+user+"&passwd="+passwd;
// find it in the logs if you don't have server side scripting.
}

/L
 
A

asdf asdf

Here's one idea:

If you're in IE, you can use window.showModalDialog.

In the modal popup, you can have code to perform the login logic and
set the window.returnValue to true or false before closing.

Then, in the main window you can check the return value of the
function call and act accordingly.
 
L

Lee

asdf asdf said:
Here's one idea:

If you're in IE, you can use window.showModalDialog.

In the modal popup, you can have code to perform the login logic and
set the window.returnValue to true or false before closing.

Then, in the main window you can check the return value of the
function call and act accordingly.

I could access the site using some other browser and read the password
from the JavaScript source, or simply find out what "act accordingly"
means in this case, and do that.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
474,085
Messages
2,570,597
Members
47,218
Latest member
GracieDebo

Latest Threads

Top