1

The main html file contains following javascript source

<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
<title>Hello Worlds</title>
<link rel="stylesheet" href="css/main_page.css" type="text/css"/>
<link rel="stylesheet" href="css/page_content.css" type="text/css"/>
<script type="text/javascript" src="js/jquery.js"></script>

<script type="text/javascript" src="js/util.js"></script>
<script type="text/javascript" src="js/main_page.js"></script>
<script type="text/javascript" src="js/page_content.js"></script>
<script type="text/javascript" src="js/configurator.js"></script>
<meta http-equiv="Cache-Control" content="no-cache"/>
<meta http-equiv="Pragma" content="no-cache"/>
<meta http-equiv="Expires" content="0"/>

one of the form's post called a javascript function which belongs to page_content.js file.

I am trying to inovke the function using following

$scripter->get('javascript:submitForm()');

but it's not working. Please help me how can I call the function which belongs to the page_content.js file.

1
  • 2
    Please show some code. WWW::Scripter needs an engine to actually parse the javascript. Which one are you using? You probably have to parse the HTML and download the JS files. (but I'm not 100% certain) Commented Feb 18, 2011 at 15:02

1 Answer 1

1

If the html page (with address stored in $url) contains (internally or externally) JavaScript that define function/procedure submitForm() then you can execute it by the following code:

use WWW::Scripter;

$w = new WWW::Scripter;
$w->use_plugin('JavaScript');

$w->get($url);
$w->eval('submitForm();');

For more information see WWW::Scripter documentation.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.