Hacking COMPLETED SwitchBru DNS Update v4.0.0 Public Beta

  • Thread starter Thread starter Ep8Script
  • Start date Start date
  • Views Views 51,186
  • Replies Replies 147
  • Likes Likes 20
One question, is there a way to put a button that returns you to the home page of the menu while you use the browser? It's silly but when you have been using the internet for a while and want to go back to the Google search engine or want to go to one of your saved links on the SwitchBru page, you have to either press B several times back or remove and set the browser again, losing time.

Your post got me to test my idea I've had as a way to do that to see if it would work... Well it works, except a lot of sites restrict you from being able to use it (a security worry). So it's ultimately not as useful as it could be. Yes it's true we can't control the browser directly just through dns, but we can make it load a page with a home button and url field header, and an iframe embedding your browsing page within it. So that as you navigate, the header with the url field and home button stays at the top but the iframe changes pages. The idea being to always be able to quickly go back home, or to any url.

Here's an example of what I mean (and my new default 'captive portal' page):
Code:
<html>
<head><title>YourFrendlyDNS Starting Place!</title>
<style>
body {
margin: 0;
padding: 0;
border: 0;
overflow: hidden;
height: 100%;
max-height: 100%;
}

#urlfield_header {
background: white;
position: fixed;
top: 0px;
left: 0;
right: 0;
bottom: 0px;
width: 100%;
overflow: hidden;
}

#navi {
position: fixed;
top: 23px;
left: 0;
right: 0;
bottom: 0px;
overflow: hidden;
}
</style>

<script>
function keysDown(event)
{
    if(event.keyCode == 13)
        go();
}

function go()
{
     var url = document.getElementById("urlfield").value;
     if(!url.includes("http://") && !url.includes("https://"))
         url = "http://" + url;
     document.getElementById("pagecontent").src = url;
}
</script>
<body>

<div id="urlfield_header">
<input type="button" id="home" value="Home" onclick="document.getElementById('urlfield').value ='startpage.com'; go()"/>
<input type="text" id="urlfield" onkeydown="keysDown(event)" style="width: 50%"/>
<input type="button" id="navigate" value="Go!" onclick="go()"/>
</div>

<div id="navi">
<iframe id="pagecontent" src="https://startpage.com" width="100%" height="100%" frameborder="0"/>
</div>

</body>
</html>

bti1OLx.png

Pictured: I attempted to load an NXDOMAIN / non existent domain (same effect as a blocked one) and was then redirected to the server's captive portal. (the attached small html page) I then tried to navigate to gbatemp.net from the makeshift url field, and as you can see from the image "Load denied by X-Frame-Options-> 'does not permit cross-origin framing' ". Then I hit the home button and it loaded back to startpage... (So startpage of course doesn't have this setting set).

In theory if you do mostly go to places that don't block cross origin framing, then this method would be acceptable to you. Well maybe the switches browser doesn't care about the X-Frame-Options header though, but seems unlikely. Well it was worth a shot! And it does work except for the X-Frame-Options problem. So it's either take some more extreme measures(for a very un-extreme thing like web browsing?) or we should just homebrew it which will either let us control the browser normally or a homebrew fully featured browser! I'd say that's our best bet, in the meantime make the best of what we have!
 
Your post got me to test my idea I've had as a way to do that to see if it would work... Well it works, except a lot of sites restrict you from being able to use it (a security worry). So it's ultimately not as useful as it could be. Yes it's true we can't control the browser directly just through dns, but we can make it load a page with a home button and url field header, and an iframe embedding your browsing page within it. So that as you navigate, the header with the url field and home button stays at the top but the iframe changes pages. The idea being to always be able to quickly go back home, or to any url.

Here's an example of what I mean (and my new default 'captive portal' page):
Code:
<html>
<head><title>YourFrendlyDNS Starting Place!</title>
<style>
body {
margin: 0;
padding: 0;
border: 0;
overflow: hidden;
height: 100%;
max-height: 100%;
}

#urlfield_header {
background: white;
position: fixed;
top: 0px;
left: 0;
right: 0;
bottom: 0px;
width: 100%;
overflow: hidden;
}

#navi {
position: fixed;
top: 23px;
left: 0;
right: 0;
bottom: 0px;
overflow: hidden;
}
</style>

<script>
function keysDown(event)
{
    if(event.keyCode == 13)
        go();
}

function go()
{
     var url = document.getElementById("urlfield").value;
     if(!url.includes("http://") && !url.includes("https://"))
         url = "http://" + url;
     document.getElementById("pagecontent").src = url;
}
</script>
<body>

<div id="urlfield_header">
<input type="button" id="home" value="Home" onclick="document.getElementById('urlfield').value ='startpage.com'; go()"/>
<input type="text" id="urlfield" onkeydown="keysDown(event)" style="width: 50%"/>
<input type="button" id="navigate" value="Go!" onclick="go()"/>
</div>

<div id="navi">
<iframe id="pagecontent" src="https://startpage.com" width="100%" height="100%" frameborder="0"/>
</div>

</body>
</html>

bti1OLx.png

Pictured: I attempted to load an NXDOMAIN / non existent domain (same effect as a blocked one) and was then redirected to the server's captive portal. (the attached small html page) I then tried to navigate to gbatemp.net from the makeshift url field, and as you can see from the image "Load denied by X-Frame-Options-> 'does not permit cross-origin framing' ". Then I hit the home button and it loaded back to startpage... (So startpage of course doesn't have this setting set).

In theory if you do mostly go to places that don't block cross origin framing, then this method would be acceptable to you. Well maybe the switches browser doesn't care about the X-Frame-Options header though, but seems unlikely. Well it was worth a shot! And it does work except for the X-Frame-Options problem. So it's either take some more extreme measures(for a very un-extreme thing like web browsing?) or we should just homebrew it which will either let us control the browser normally or a homebrew fully featured browser! I'd say that's our best bet, in the meantime make the best of what we have!
Another website was already set up with iframes, but yeah of course it follows cross origin rules - iframes just don't work for it at all.

YES! A chatroom!!! That's all I needed.
Good to hear! There's group chats coming in a future update. :)
 
Looks like friend requests are broken it seems
I don't think they are broken, I still got one other today... unless that was you (well, I don't actually remember but still) and I forgot, what's your name on there?

Maybe try adding me again
 
Think it could be related to the issue we had with it yesterday where I appeared as "offline", but wasn't?
 
  • Like
Reactions: Ep8Script
Think it could be related to the issue we had with it yesterday where I appeared as "offline", but wasn't?
Nah not really, I think that was because you came back from another page and it didn't check for notifications again. Not too sure how to fix that.
 
  • Like
Reactions: Taffy
I don't think they are broken, I still got one other today... unless that was you (well, I don't actually remember but still) and I forgot, what's your name on there?

Maybe try adding me again

It's the same as it is on here, PatrickJr.

Says

You have already sent this user a friend request.
 
Last edited by PatrickJr,

Site & Scene News

Popular threads in this forum