I want to get the links to the current repl that’s not the cover page(aka repl.co) in JavaScript but I don’t know how. Also, how do I redirect to another page in js?
If I remember correctly:
var currentURL = window.location.href;
console.log(currentURL);
Now, how do I redirect to another site?
ah, you beat me to it, I got distracted lol. that includes the current page (like if you’re on /about then that logs https://SLUG--username.repl.co/about if dat makes sense)
location.replace('/');
For some reason, it does name—author.repl.co
instead, which won’t work with what I’m doing.
nvm actually, it’s because I coded something wrong.
How tho do I detect if it’s in the cover page or a webview?
Ok so a couple things to know before posting your question to Ask:
- Figure it out yourself, or, at least try to. It doesn’t take more than a quick Google search to figure out how to redirect a user and it shouldn’t be too hard to find a solution to seeing if your webpage is in an
iframe
. - If you’re trying to achieve X, don’t ask for how to do Y because you think Y will help you achieve X. In this case, you thought that getting the window’s location would allow for you to check if a user is viewing through the cover page, however that isn’t the case (well, I’m assuming that’s why you asked to get the current link of the page with JS).
- Always look to see if your question has been answered. Kind of similar to #1 but not the same. In your case, the question has already been answered (but I can’t find the topic lol. I’ll post the solution here when I find it)
I’m trying to make a turbowarp(turbowarp is a mod of scratch that has many custom features, including custom extension) extensions template, and when the run button is used, it’s supposed to redirect to https://turbowarp.org/editor?extension=https://repl-name—author-repl.co and Replit cover page embeds sites whenever it redirects, which turbowarp doesn’t allow embeds.
Also, I’ve tried to look for someone else with the same problem, but I was unsuccesful.
I’m trying to make a turbowarp(turbowarp is a mod of scratch that has many custom features, including custom extension) extensions template, and when the run button is used, it’s supposed to redirect to https://turbowarp.org/editor?extension=https://repl-name—author-repl.co and Replit cover page embeds sites whenever it redirects, which turbowarp doesn’t allow embeds.
Also, I’ve tried to look for someone else with the same problem, but I was unsuccesful.
I believe this has been asked before, an easy check is this: window.top === window
which checks if the current window
is the top window or not, of our isn’t, the code is in an iframe
or pop-up
Yeah that’s what I meant here
Wonder what happened to the topic? I searched and couldn’t find it either
wdym pop-up
window.open("some url");
(I think in that case window.top
will be different from window
but not 100% sure)
Thanks. If only I could mark multiple answers as solutions, that would be nice.
That’ll never be added because separate questions should have separate topics.
You can make a reply to your topic quoting all of the solutions, and mark your reply as the solution.
Well, if you ask two operations you want to perform on a string, for example, and person A tells you the first one you wanted to know and person B tells you the other part.
This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.