无法从phantomjs打开behance.net

时间:2017-06-06 06:29:05

标签: javascript jquery phantomjs

我想通过phantomjs打开behance.net。

不幸的是,Behance没有开放。它看起来像behance的错误页面。

这是我的代码:

open("url", function(){
    console.log('loaded'); // only one
})

UPD

我将页面渲染为jpeg,它只是一个黑屏。

UPD 2.解决方案

Behance在页面内使用了3个iframe,因此onLoadFinished调用了3次。但是当你打电话时

onLoadFinished

解决方案: 在open函数

之外写page.onLoadFinished = function(status) { console.log('loaded'); // three times. On three the page is loaded } 函数
<%- include('partials/header') %>
    <div class="form-container">
        <h2>Login</h2>
        <% if(locals.error) { %>
            <div class="alert alert-danger"><%= error %></div>
        <% } %>
        <% if(locals.success) { %>
            <div class="alert alert-success"><%= success %></div>
        <% } %>
        <form method="post" action="">
            <div class="form-group">
                <label for="username">Username</label>
                <input type="text" name="username" id="username" value="<%= locals.username || '' %>" class="form-control" />
            </div>
            <div class="form-group">
                <label for="password">Password</label>
                <input type="password" name="password" id="password" class="form-control" />
            </div>
            <div class="form-group">
                <button type="submit" class="btn btn-primary">Login</button>
                <a href="/register" class="btn btn-link">Register</a>
            </div>
        </form>
    </div>
    <%- include('partials/footer') %>

1 个答案:

答案 0 :(得分:1)

  

我们注意到您使用的是过期版本   IE浏览器。这个版本是   Behance不支持。

这个网站不喜欢旧的IE版本(我不会责怪它)。

使用自定义用户userAgent:http://phantomjs.org/api/webpage/property/settings.html

这将阻止Phantom将该页面作为Internet Explorer请求,并且该站点将接受加载。