Skip to main content
divisionb35151626
Participant
December 19, 2016
Question

htmlloader - set parameter in js [AIR]

  • December 19, 2016
  • 1 reply
  • 278 views

In the loaded html page has a parameter: param = 0.

For example, I want to change the parameter to: param = 1

I do: htmlloader.window.param = 1

The parameter is replaced, but I need to get changed the whole page.

When I do this: document.documentElement.outerHTML

in the JS script still remains: param = 0;

What could be the problem and whether it is possible to solve it?

maybe it's a bug?

This topic has been closed for replies.

1 reply

divisionb35151626
Participant
December 23, 2016

Maybe my question is not clear. More:

test.html

<script>
  
var param = 0;
</script>

as3

htmlString = File.documentsDirectory.resolvePath("test.html");

createHtmlLoader
(htmlString.nativePath);

private function createHtmlLoader(url:String):void {  
  html
= new HTMLLoader();
  
var urlReq:URLRequest = new URLRequest(url);
  html
.width = 550;
  html
.height = 400;
  html
.addEventListener(Event.COMPLETE, onLoad);
  html
.load(urlReq);
}

private function onLoad(e:Event):void {

  var document = html.window.document;
 

  //!! in trace: param = 0
  trace
(html.window.param);

  
//!! set param = 1
  html
.window.param = 1;

  
//!! in trace: param = 1; ok
  trace
(html.window.param);

  trace
(document.documentElement.outerHTML);
  
//!! in trace: param = 0; Why?
}

When i want to get the whole document: document.documenElement.outerHTML

JS script remains unchanged.