Piotr Migdal
Piotr Migdal

Reputation: 12792

GitHub Jupyter viewer blocking links to Google Colab

I try to link from Jupyter Notebooks hosted at GitHub to their interactive versions at Google Colab. However, links do not work (GitHub blocks them, one need to copy and paste them or right-click and manually select "open in a new tab").

Examples: Gradient descent and Using an ImageNet-pretrained model from Thinking in tensors, writing in PyTorch.

enter image description here

What does not work:

[![](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/stared/thinking-in-tensors-writing-in-pytorch/blob/master/3%20Linear%20regression.ipynb)

or

<a href="https://colab.research.google.com/github/stared/thinking-in-tensors-writing-in-pytorch/blob/master/3%20Linear%20regression.ipynb">
    <img src="https://colab.research.google.com/assets/colab-badge.svg"/>
</a>

Then after clicking (on GitHub; locally there is not problem) there is:

enter image description here

If I add <a href="..." target="_blank">...</a> then clicking does nothing and I see error message (Chrome console):

Blocked opening 'https://colab.research.google.com/github/stared/thinking-in-tensors-writing-in-pytorch/blob/master/extra/Using%20an%20ImageNet-pretrained%20model.ipynb' in a new window because the request was made in a sandboxed frame whose 'allow-popups' permission is not set.

Upvotes: 0

Views: 705

Answers (1)

jakevdp
jakevdp

Reputation: 86320

You can use target="_parent" within the link anchor tags, which is what Colab does when it adds such links to notebooks saved on github.

Upvotes: 2

Related Questions