instantpage / instant.page

Make your site’s pages instant in 1 minute and improve your conversion rate by 1%
https://instant.page
MIT License
6.04k stars 205 forks source link

Real Whitelist: allow deactivate plugin for every href #18

Closed jsanchezs closed 5 years ago

jsanchezs commented 5 years ago

I would like to deactivate for every href and only activate for those with the data-instant attribute.

Does it make sense?

dieulot commented 5 years ago

What’s the use case for this?

jsanchezs commented 5 years ago

@dieulot In our dashboard (the main page), we have several menu items. Some of them, makes a lot of request to our database, some of them not.

We want to use this plugin only for some URLs. As we optimice the requests, we will use the plugin on those URLs

dieulot commented 5 years ago

Thanks. I don’t think your use case warrants the feature, in your case I’d recommend putting data-no-instant attributes on links even though this might be tedious.

Note that you might simulate the behavior you want with a bit of JavaScript:

var notInstantLinks = document.querySelectorAll('a:not([data-instant])')
for (var i = 0; i < notInstantLinks.length; i++) {
  notInstantLinks[i].dataset.noInstant = ''
}

I’m leaving this open for now as I’d like to hear use cases from other people.

rilwis commented 5 years ago

I'd like to add this feature as well.

On my website https://gretathemes.com/wordpress-themes/thefour/, I only want to preload the demo theme page, so users have better experience. Preloading other links is not necessary to me at the moment.

I remember I can do that with InstantClick.

PikachuEXE commented 5 years ago

I'd like to add this feature as well.

My website got a list of big boxes with carousel inside links (very easy to hover and click on them) There are buttons on those boxes too and we only want some of those buttons to be preloaded

I don't want to invalidate all the big boxes' cache to disable preloading (and I am fine having no preloading on old big boxes' buttons)

PikachuEXE commented 5 years ago

29 is opened to add whitelist mode

csswizardry commented 5 years ago

Surely if prefetching is the exception rather than the rule, instant.page is simply not the tool you need…?

PikachuEXE commented 5 years ago

Opt-out vs Opt-in I prefer the later one, same as some other people Should a tool not be provided an option for users to opt-in as they want?

PikachuEXE commented 5 years ago

If you have more questions/opinion about #29 please put a comment there

dieulot commented 5 years ago

Shipped in 1.3: https://instant.page/blacklist#whitelist