-
-
Notifications
You must be signed in to change notification settings - Fork 1.5k
dom createA('#', 'link') function doesn't work as expected #145
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
@yining1023 it's working for me when I run the sketch, what specifically is not working for you? |
@shiffman helped me to narrow down the problem. So I rephrased the issue above. |
In the future what I want to do is render the iframe preview on a separate subdomain, for security reasons. I think it will fix this issue, but I'm not 100% sure. |
If you run the sketch in full - https://editor.p5js.org/full/rJ9PtlA0 - clicking on the link will instead provide:
As it attempts to navigate to I have found the same behavior when attempting to navigate to anchor links in other sketches. Example here which uses anchor HTML from MDN Expected behavior: clicking on link should cause page/sketch to navigate to anchor Actual behavior: page/sketch disappears to be replaced with |
NOTE: Apparently, pre-pending So, instead of Example here that works Solution found on stackoverflow |
oh, that's so awesome! the web editor could process all links that begin with a |
Sounds like that would work. NOTE: it would have to be a prepend-on-render, or the links will not work when the sketch is downloaded, as the document is no longer |
Yes! There's some code in the web editor that doesn't get injected when a sketch is downloaded, which is
|
The Expected behaviour: clicking on the 'blue berry' links only causes mousePressed function Actual behaviour: clicking on the 'blue berry' links causes mousePressed function and then shows a blank preview Example: |
Instead of |
Uh oh!
There was an error while loading. Please reload this page.
I tried to run the following sketch: http://alpha.editor.p5js.org/projects/rJ9PtlA0. It writes:
When user clicks on the link, it should do nothing. But in the editor, it will navigate the iframe to the whole web editor page, which totally makes sense. It's just an issue raised by running code in an iframe instead of the whole page. Maybe we could add something to prevent it from navigating away?
The text was updated successfully, but these errors were encountered: