Skip to content
This repository has been archived by the owner on May 30, 2023. It is now read-only.

onInitialized event triggers ONLY when the page content has script elements #12387

Closed
EtherDream opened this issue Jul 19, 2014 · 2 comments
Closed
Labels

Comments

@EtherDream
Copy link

phantomjs

page.onAlert = function(msg) {
    console.log(msg);
};
page.onInitialized = function() {
    page.evaluate(function() {
        document.addEventListener('error', function(e) {
            alert(12345);
        }, true);
    });
};

html page

<div>
    <img src="*" />
</div>
<script>
</script>

output: 12345

html page without script

<div>
    <img src="*" />
</div>

output nothing

@JamesMGreene
Copy link
Collaborator

True story, I've suffered from this one before as well. IIRC, onLoadStarted may also fall victim to this.

@JamesMGreene JamesMGreene changed the title event donot trigger when page has no <script> element onInitialized event triggers ONLY when the page contents has script elements Jul 20, 2014
@JamesMGreene JamesMGreene changed the title onInitialized event triggers ONLY when the page contents has script elements onInitialized event triggers ONLY when the page content has script elements Jul 20, 2014
@ghost ghost removed the old.Status-Accepted label Dec 19, 2017
@stale stale bot added the stale label Dec 26, 2019
@stale
Copy link

stale bot commented Dec 29, 2019

Due to our very limited maintenance capacity (see #14541 for more details), we need to prioritize our development focus on other tasks. Therefore, this issue will be automatically closed. In the future, if we see the need to attend to this issue again, then it will be reopened. Thank you for your contribution!

@stale stale bot closed this as completed Dec 29, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

2 participants