tags:

views:

85

answers:

2

I am using POST to submit a form to a web-based login server from a java application.

However, the webpage requires both cookies and a popup blocker, which are detected and handled in an init() javascript function:

if (document.cookie == "") {
        alert("Cookies are disabled. Cannot access server with this setting.\nPlease configure your browser to accept cookies.");
        return;
    }

detectPopupBlockers();

It appears that cookies are only ever used in the detectPopupBlockers() function (to indicate that a message has already been shown if the user does not have a popup blocker enabled).

Is there a way I can completely avoid the init() function that is called by the onload parameter? Or somehow emulate that cookies and a popup blocker are in fact enabled? My only guess at a third option is to somehow dismiss the popup message telling me I have no cookies and submit the form anyway.

+1  A: 

If it bound like so:

<body onload="init();">

Or like this:

document.body.onload = init;

You can just do this:

document.body.onload = null;

Directly under the body tag.

roar
Unfortunately, I cannot edit the remote file.
+2  A: 

I'm assuming you are using something like WebClient to do the posting - couldn't you just disable Javascript and bypass the checks altogether?

Eric Petroelje
I am just using java's HttpURLConnection class, nothing like WebClient