浏览器阻止App Engine静态页面上的Mathjax [英] Browser blocking Mathjax on app engine static page

查看:48
本文介绍了浏览器阻止App Engine静态页面上的Mathjax的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试提供一个静态页面,其中包含要由Mathjax呈现的Tex样式的Math.这些网页由Google应用引擎上的Flask应用提供.问题是-Chrome,Opera和Edge-所有浏览器都阻止Mathjax渲染数学,但是如果我在每次加载页面时从浏览器顶部手动解除阻止它,都可以正常工作.该网站可以在脱机状态下正常运行,但是通过App Engine应用程序访问页面时会出现问题.有什么方法可以防止浏览器阻止脚本?请注意,Mathjax是从官方CDN加载的,但是我也尝试过使用本地副本.

I am trying to serve a static page containing Tex-style Math that is to be rendered by Mathjax. The pages are being served by a Flask app on Google app engine. Problem is - Chrome, Opera and Edge - all browsers are blocking Mathjax from rendering the Math, but it works properly if I manually unblock it from on top of the browser every time the page loads. The site works perfectly offline, but the problem occurs when the page is accessed through the app engine app. Any way to prevent the browser from blocking the script? Note that Mathjax is being loaded from the official CDN, but I have also tried using a local copy.

示例链接: https://20200407t065833-dot-clip-sync-03.appspot.com/book_preview_chapter_1

推荐答案

主要问题是您正在使用https通过加密页面上的http通过Math加载MathJax-出于安全原因,浏览器将阻止此类内容.在本地计算机上,您可能正在使用file://或localhost加载页面,因此该问题不会在此处发生.

The main problem is that you're loading MathJax via http on an encrypted page using https - browsers will block such content for security reasons. On your local machine, you are probably using file:// or localhost to load the page, so this problem does not happen there.

另一方面,您还使用的是MathJax的非常旧的版本(cdn.mathjax.org很久以前就已淘汰).最后,页面标记实际上不是有效的HTML(尽管解析器会对其进行修复).

On a side note, you are also using a very old version of MathJax (cdn.mathjax.org was retired a long time ago). Finally, the page markup is not actually valid HTML (though parsers will fix it).

这是一个可行的例子.

<!DOCTYPE html>
<html lang="en" dir="ltr">
  <head>
    <meta charset="utf-8">
    <title>TITLE MUST BE NON EMPTY</title>
<script src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.7/MathJax.js?config=TeX-AMS-MML_HTMLorMML"></script>
  </head>
  <body>
    <h1>অধ্যায় ১</h1>
    <h2>বিভাজ্যতা <br>
    Divisibility </h2>

    <p>বিভাজ্যতা নিয়ে আমরা সবসময়ই জেনে বা না জেনে ভেবেছি। যেমন আমার \(10\) টা চকলেট থাকলে সেগুলো \(5\) জন বন্ধুকে সমানভাবে ভাগ করে দেওয়া যাবে, কিন্তু চারজনকে সমান ভাগ করে দেওয়া যাবে না। অথবা স্কুলের ক্লাসে \(45\) জন ছাত্র থাকলে তারা \(5\) বা \(9\) টা লাইনে সমানভাবে দাঁড়াতে পারে, কিন্তু \(4,6\) বা \(10\) টা লাইনে দাঁড়ালে সব লাইনে সমান সংখ্যক ছাত্র থাকতে পারে না। এই সাধারণ ধারণাগুলোই সংখ্যাতত্ত্বের ভিত্তি। কিন্তু সাধারন এই ধারনাগুলোই জন্ম দিয়েছে অসংখ্য অসাধারন সমস্যার। মানুষ তার কতগুলোর সমাধান করতে  পেরেছে। আবার কতগুলোর কোন কুল-কিনারা করা যায়নি। যেমন বলা যায় ফার্মার শেষ উপপাদ্যের কথা। এই উপপাদ্য বলে, \(n>2\) একটা পূর্ণসংখ্যা হলে এমন তিনটি স্বাভাবিক সংখ্যা \(a,b,c\) পাওয়া যাবে না যেন \(a^n+b^n=c^n\) হয়।  আপাত দৃষ্টিতে সরল দর্শন এই সমস্যার সমাধান করতে মানুষের লেগেছে প্রায় চারশ বছর! যদিও ফার্মা নিজেই চমৎকার একটি প্রমাণ আবিষ্কার করার দাবি করেছিলেন, তবুও তার সত্যতা যাচাই করা যায়নি।</p>
...
</body>
</html>

这篇关于浏览器阻止App Engine静态页面上的Mathjax的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆