8000 Embedding jsCoq on any webpage · Issue #352 · jscoq/jscoq · GitHub 8000
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content
Embedding jsCoq on any webpage #352
Open
@praalhans

Description

@praalhans

The general problem is this: how can jsCoq be embedded in every webpage on the web, under the following constraints:

  • No access to the files hosted on the domain (only limited access to the HTML of the page),
  • Making use of a CDN to deliver the files.

More specifically. I'm using a hosted Ghost instance, in which I want to embed jsCoq into some of the pages. The domain is out of my control (it is hosted by GhostPro) so I cannot host the required files. Nor can I edit the HTML code of the page in which jsCoq is inserted. Instead, I try to make use of jsDelivr, from which the static files can be served.

After several tries, the closest I could get in having a working jsCoq embedded on one of my pages, is to use the following snippet (which is inserted before the closing </body> tag):

<script type="module" crossorigin="anonymous">
import { JsCoq } from 'https://cdn.jsdelivr.net/npm/wacoq@0.16.0/ui-js/index.min.js';
document.querySelectorAll('.site-main')[0].id = 'ide-wrapper';
var jscoq_ids  = ['.snippet'];
var jscoq_opts = {
    base_path: 'https://cdn.jsdelivr.net/npm/wacoq@0.16.0',
    pkg_path: 'https://cdn.jsdelivr.net/npm/wacoq-bin@0.16.0/bin/coq',
    node_modules_path: 'https://cdn.jsdelivr.net/npm/',
    prelude:       true,
    implicit_libs: true,
    editor:        { mode: { 'company-coq': true } },
    init_pkgs:     ['init'],
    all_pkgs:      ['coq']
};
JsCoq.start(jscoq_ids, jscoq_opts);
</script>

A number of issues arise, of which the most important one is the following:

Since the script tag is already marked with crossorigin I have tried to avoid this error, but to no avail.

Several less important issues also arise:

These resources all resolve to 404 Not Found (notice the missing /)

After tweaking the base_path (adding a final / to the path), the GET request still fails but then due to having a slash too much:

Resulting in a 400 Bad Request (probably due to the double slash).

Any idea how to solve this issue?

Using jsCoq 1.16.0

The following snippet:

<script type="module" crossorigin="anonymous">
import { JsCoq } from 'https://cdn.jsdelivr.net/npm/jscoq@0.16.0/ui-js/index.min.js';
document.querySelectorAll('.site-main')[0].id = 'ide-wrapper';
var jscoq_ids  = ['.snippet'];
var jscoq_opts = {
    base_path: 'https://cdn.jsdelivr.net/npm/jscoq@0.16.0',
    pkg_path: 'https://cdn.jsdelivr.net/npm/jscoq@0.16.0/coq-pkgs',
    node_modules_path: 'https://cdn.jsdelivr.net/npm/',
    prelude:       true,
    implicit_libs: true,
    editor:        { mode: { 'company-coq': true } },
    init_pkgs:     ['init'],
    all_pkgs:      ['coq']
};
JsCoq.start(jscoq_ids, jscoq_opts);
</script>

The above error appears, which seems the reason why jsCoq won't load. Also the minor issues:

where both above give 404.

Other versions

I also tried 0.17.1, 0.15.0, and 0.14.0 These all leads to CORS issues, so I did not try these any further.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      0