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

Disabling loading pages via XHR #116

Open
fahad19 opened this issue Jul 27, 2016 · 8 comments
Open

Disabling loading pages via XHR #116

fahad19 opened this issue Jul 27, 2016 · 8 comments

Comments

@fahad19
Copy link
Contributor

fahad19 commented Jul 27, 2016

First of all, many many thanks for this awesome project! It looks so beautiful, I couldn't resist myself from using it for a new project of mine. Really well done!


The issue

I came across a very rare issue. When there are links for the same domain, but not of the docs itself, there is an XHR failure, and the UI keeps on loading.

Real life example

For example, in this page https://fahad19.github.io/tydel/examples/counter/index.html, if you click on Source, it will not load.

The docs are hosted in https://fahad19.github.io/tydel/, and I am trying to link to https://fahad19.github.io/tydel-demos/. GitHub Pages of two separate repos.

Possible solution

I believe, if the linked URL does not start with https://fahad19.github.io/tydel/ (with an ending slash), we should not try to load it via XHR and just go to that URL directly.

@rstacruz
Copy link
Contributor

Ahh, right. That functionality is provided by pjax which docpress-base uses.

The fix might be to simply not load URL's that start with http://, which i guess can be done with elements: 'a:not([href^="http://"])'. Would this be enough for you?

@rstacruz
Copy link
Contributor

Also I see you're using docpress-rsc haha. I take it you weren't a fan of the default theme?

@fahad19
Copy link
Contributor Author

fahad19 commented Jul 28, 2016

@rstacruz: just wanted to mention, the real life example wouldn't work any more, now the domain name is http://tydel.js.org, while demo urls are at https://fahad19.github.io/tydel-demos/counter

Your docpress-rsc theme is super cool! I just tweaked it a bit for hiding the search icon on top left, and sub-headers in sidebar nav. really really like your taste in typography :)

The fix might be to simply not load URL's that start with http://, which i guess can be done with elements: 'a:not([href^="http://"])'. Would this be enough for you?

Sounds good for me 👍 . Even though I would not be affected by this issue any more, but someone else might face it sometime.

@rstacruz
Copy link
Contributor

bump, looks like I forgot this.

@knownasilya
Copy link
Member

Related issue #138

@Kikobeats
Copy link
Contributor

I think that this is a good intermediate solution:

https://github.com/Easyfood/pageAccelerator#how-to-use

adding data-pageAccelerator="false" you disable the injection, so you can control what do you want to be injected.

@Kikobeats
Copy link
Contributor

pageAccelerator looks lightweight, but currently I prefer use http://instantclick.io/ because you can add blacklisting links easily:

It may sometimes be more convenient to blacklist a group of links, instead of adding data-no-
instant attributes to all of them.

To blacklist all links in a parent element, add data-no-instant to that element.

http://instantclick.io/blacklisting

Also it supports blacklisting dynamically.

@rstacruz
Copy link
Contributor

rstacruz commented Sep 25, 2016

I haven't seen instantclick before but the premise looks very interesting.
But yes: it'd be nice to have some sort of opt out mechanism.

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

4 participants