question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Instant navigation breaks third-party URLs

See original GitHub issue
  • I’ve read the [contribution guidelines][1] and agree with them

I’ve found a bug and checked that …

  • … the problem doesn’t occur with the default MkDocs template
  • … the problem is not in any of my customizations (CSS, JS, template)
  • … the documentation does not mention anything about my problem
  • … there are no open or closed issues that are related to my problem

Description

Enabling navigation.instant modified Isso requests URLs on first load. A page reload restores them.

Expected behavior

Requests are sent to usual URLs

Actual behavior

Requests are sent to a non existent URL

Steps to reproduce the bug

My website has https://example.org/mkdocs/ set as site_url and loads on every page the following Isso code:

{% block disqus %}
 {% if not page.is_homepage %}
  <script data-isso="https://example.org/comments" src="https://example.org/comments/js/embed.dev.js"></script>
  <section id="isso-thread"></section>
 {% endif %}
{% endblock %}

The file embed.dev.js is the minified version of this attached file: embed.dev.js.txt. It generates URLs from the “data-isso” attribute.

Without navigation.instant, comments are properly loaded:

  • First load
Code Method URL
200 GET https://example.org/mkdocs/PAGE
200 GET https://example.org/comments/js/embed.dev.js
200 POST https://example.org/comments/count
200 GET https://example.org/comments/?uri=PAGE&nested_limit=5
  • Page Reload
Code Method URL
200 GET https://example.org/mkdocs/PAGE
200 GET https://example.org/comments/js/embed.dev.js
200 POST https://example.org/comments/count
200 GET https://example.org/comments/?uri=PAGE&nested_limit=5

I noticed that by enabling navigation.instant the request URLs appear modified (XHR interceptor?), but only at the first load of the page.

A user has has in fact to press F5 everytime he changes page, otherwise he will see the comment section, but he won’t be able to create or load comments.

  • First load
Code Method URL
200 GET https://example.org/mkdocs/PAGE
200 GET https://example.org/comments/js/embed.dev.js
404 POST https://example.org/assets/javascripts/bundle/count
404 GET https://example.org/assets/javascripts/bundle/?uri=PAGE&nested_limit=5
  • Page reload
Code Method URL
200 GET https://example.org/mkdocs/PAGE
200 GET https://example.org/comments/js/embed.dev.js
200 POST https://example.org/comments/count
200 GET https://example.org/comments/?uri=PAGE&nested_limit=5

I have tried with clean MkDocs directories multiple times and the problem always (and only) appears when enabling instant navigation.

Package versions

  • Python: 3.9
  • MkDocs: 1.1.2
  • Material: 7.0.0

System information

  • OS: any
  • Browser: any

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:20 (15 by maintainers)

github_iconTop GitHub Comments

1reaction
squidfunkcommented, Mar 7, 2021

b6779114 now preserves all attributes of the script tag. This might fix the issue.

1reaction
AlphaJackcommented, Mar 2, 2021

Before we proceed, it’s necessary to provide a reproducible example.

Here’s the same zip I mailed you, also in case @polarathene would like to give it a try: material-isso.zip

Please go back and forth between “home” and “test”, so you can see the actual behaviour. By reloading a page you will see that the error is gone. The file javascript file of the “src” attribute is always loaded properly, the URLs that are modified are the ones generated by that file.

  • First load: first-load

  • Page reload: reload

Read more comments on GitHub >

github_iconTop Results From Across the Web

Sending users to a 3rd-party site and then back
We'd like to avoid using an iframe, though, for the usual reasons. (Breaks the back button, etc.) What are some alternatives? navigation.
Read more >
How To Find Broken Links Using The SEO Spider
1. Open up the SEO Spider, type or copy in the website you wish to crawl in the enter url to spider box...
Read more >
How to Find Broken Links in Selenium : Example | BrowserStack
Broken links may exist due to some kind of server error, which, in turn, causes the corresponding page to malfunction and not be...
Read more >
Navigate to a third party URL without making it available in ...
@mplungjan Hi, I am using window.open(this.redirectUrl, "_self"); for redirection to the payment gateway. if I use location.replace(this.
Read more >
5 Ways to Integrate Third-Party Tools on Your WebsIte
This enables the website owner to use the application features without building a CRM into their site from scratch. To break it down...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found