By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
459,964 Members | 1,810 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 459,964 IT Pros & Developers. It's quick & easy.

Sending message on load

P: n/a
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?
Jul 20 '05 #1
Share this Question
Share on Google+
3 Replies


P: n/a
Fr***********@rbos.com (Francis Lewis) writes:
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
--
Lasse Reichstein Nielsen - lr*@hotpop.com
Art D'HTML: <URL:http://www.infimum.dk/HTML/randomArtSplit.html>
'Faith without judgement merely degrades the spirit divine.'
Jul 20 '05 #2

P: n/a
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.

Lasse Reichstein Nielsen <lr*@hotpop.com> wrote in message news:<ll**********@hotpop.com>...
Fr***********@rbos.com (Francis Lewis) writes:
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?

Jul 20 '05 #3

P: n/a
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.

Jul 20 '05 #4

This discussion thread is closed

Replies have been disabled for this discussion.