Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Executing script files fails #416

Closed
ConstantinFF opened this issue Jul 25, 2014 · 1 comment
Closed

Executing script files fails #416

ConstantinFF opened this issue Jul 25, 2014 · 1 comment

Comments

@ConstantinFF
Copy link

Some of the pages loaded by jquery-pjax requires other javascript and jquery libraries and I include them along with the page content and title.
There are also some inline scripts that uses those libraries.
The problem is that the inline script is executed before the js library is loaded.
What I did is to move the line
executeScriptTags(container.scripts)
just after the:
if (container.title) document.title = container.title
so the inline script to be executed after the js is loaded

But now the script works on the second page visit. The first visit still gives an error that the library is missing.

Any possible idea for solving this?

@mislav
Copy link
Collaborator

mislav commented Jul 26, 2014

You'll have to change your site, unfortunately. Your inline scripts will now have to be aware that the libraries they depend on might be loaded async. Maybe you could do a repetitive setTimeout until a "constant" that you rely on gets defined.

A much better solution, on the other hand, would be to get rid of inline scripts. See #393 for an example how script tags sometimes simply cannot work with pjax model.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants