0

I try to get all links of a html construct generated by a script. The script is included like this: //server.de/script1.js

The JavaScript-file is not loaded. If I change the // to http:// there is no problem. How to load files with // ?

var page  = require('webpage').create();
var system = require('system');

page.onError = function(msg, trace) {
  console.log(msg);
  phantom.exit();
};

var startProcess;

function process() {
  var links = page.evaluate( function() {   
  phantom.exit();
}

page.onResourceReceived = function(requestData, request) {
  clearTimeout(startProcess);
  startProcess = setTimeout(function() {
    process();
  }, 3000);
};

var content = '<script async="async" type="text/javascript" src="//server.de/script.js"></script>';

page.content = content;

I get a timeout this way.

isherwood
  • 58,414
  • 16
  • 114
  • 157
rakete
  • 2,953
  • 11
  • 54
  • 108

0 Answers0