473,378 Members | 1,447 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,378 software developers and data experts.

Using socket code / no browser to issue a Javascript event

This may seem wierd, and I know someone asked this question before but
was told they were doing it the hard way. Unlike them, I do not have
shell access to the machine where this javascript runs.

I need to run the 'submit' method on a Javascript on a page - but I
need to do it without a browser. I can handle all the socket code,
that's not the issue, the issue is what command I need to send. I
should be able to hit the page and issue it's functionality just like
I could with a wget or by pasting a CGI with its actions into a
browser window.

Ideas?

Here's the snippet of the method I need to call - nothing special at
all.

<form name="click" action="mysite/cgi-bin/my.cgi" method="POST">
<input type="hidden" name="ses" value="366021079">
<input type="hidden" name="id" value="somevalue">
<script language="JavaScript">
<!--
document.write('<a href="javascript:document.click.submit()"><img
src="/images/img.gif" width=290 height=73 alt="alt text"
border=0></a>');
//-->
</script>

<noscript>
<input type="submit" value="Submit">
</noscript>
</form>

The browser, if I use that lists the link as:
javascript:document.click.submit().
I need to call that method remotely.
I know all the above values - that's not the issue - I just need to
find a way to make it execute the submit() function where I can pass
in the variables. I know in CGI I could do things like
.....cgi&value="foo"&value2="bar", etc.

Thanks in advance.
Jul 23 '05 #1
1 1542
Nathan DeBardeleben wrote:
This may seem wierd, and I know someone asked this question before but
was told they were doing it the hard way. Unlike them, I do not have
shell access to the machine where this javascript runs.

I need to run the 'submit' method on a Javascript on a page - but I
need to do it without a browser.
Yes, that sounds weird.
I can handle all the socket code,
that's not the issue, the issue is what command I need to send.


You lost me there. You want to run Javascript in a browser that doesn't
exist, and you want to know what command to send it?

Do you mean you want to simulate the submission of this form? You can do
that by sending out the appropriate headers with the form values in the body
of the request:
POST /cgi-bin/my.cgi HTTP/1.1
Host: mysite
Content-Type: application/x-www-form-urlencoded
Content-Length: [work it out]

ses=366021079
id=somevalue


Not really a Javascript issue though, so perhaps I've totally misunderstood
your problem.

--
Philip Ronan
ph***********@virgin.net
(Please remove the "z"s if replying by email)
Jul 23 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Barry Svee | last post by:
I'm struggling with the JavaScript blur event. I have an activex control that I need to interact with when a window loses focus, namely to instruct it to give up control of a barcode scanner so...
14
by: Michael Winter | last post by:
In an attempt to answer another question in this group, I've had to resort to calling the DOM method, Node.removeChild(), using a reference to it (long story...). That is, passing Node.removeChild....
13
by: Stumped and Confused | last post by:
Hello, I really, really, need some help here - I've spent hours trying to find a solution. In a nutshell, I'm trying to have a user input a value in form's textfield. The value should then be...
15
by: Nathan | last post by:
I have an aspx page with a data grid, some textboxes, and an update button. This page also has one html input element with type=file (not inside the data grid and runat=server). The update...
7
by: Darko | last post by:
Hello, I have this particular problem with eval() when using Microsoft Internet Explorer, when trying to define an event handler. This is the code: function BigObject() { this.items = new...
2
by: 000dreamsound000 | last post by:
Hi I am working on a security network camera system as part of a summer project of mine. The camera allows use of a TCP server for event configuration. I have coded a simple TCP server which beeps...
83
by: liketofindoutwhy | last post by:
I am learning more and more Prototype and Script.aculo.us and got the Bungee book... and wonder if I should get some books on jQuery (jQuery in Action, and Learning jQuery) and start learning about...
1
Frinavale
by: Frinavale | last post by:
Introduction I've seen many questions asked about how to disable the browser's back button and in the past I've replied with "it's simply not possible". It's not a good idea to disable the back...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.