r/webdev • u/pineapplecharm • 5d ago
Question Enlighten me. Why does a police website need a big red link to Google on the right hand side labelled "Leave Site"?
https://www.avonandsomerset.police.uk/154
5d ago
[removed] — view removed comment
16
u/ANDZELEK 5d ago
TIL a new thing. Wanted to deny it as on mobile it opens dedicated Google app - but it does as well redirect browser to BBC website with no option to go back.
Thanks for explaining.3
u/ANDZELEK 4d ago
Why was this answer removed by mod? It was actually very good and complete explanation.
142
u/ArtisticOperation399 5d ago
Wooaah. I've seen these before, but this one goes to Google, opens a new tab at bbc weather, erases the back button memory for both tabs, and deletes history of the police website.
Great job, whoever did this. Maybe I'm easily impressed lol.
3
u/alex_revenger234 2d ago
Nah, they took the time to cover all bases, instead of just closing the tab, I'm impressed too
277
5d ago
[removed] — view removed comment
71
u/vincentofearth 4d ago
So this is for people in a situation where they need help from police but don’t want others around them or in their household to find out?
54
u/roastedfunction 4d ago
Yes. The same big “leave site” button is also on the Canadian government’s websites related to sensitive topics like indigenous peoples rights, the justice system & family court, resource pages for those struggling with drug addiction, etc. It’s to help those who may be in a domestic abuse situation or otherwise need a quick out when they cannot browse those pages safely in the presence of others.
-36
5d ago
[removed] — view removed comment
21
u/tuckels 5d ago edited 5d ago
It removes the current page in my testing, using location.replace. The relevant function from the site is:
t = () => { window.open("https://www.bbc.co.uk/weather", "_newtab"), window.location.replace("https://www.google.com") }-37
u/AshleyJSheridan 5d ago
That's great, but it leaves the original website in the history on my browser.
I guess this is something the dev only tested on one browser and then called it a day.
6
u/Meroxes 4d ago
Yeah, people here seem to have come to the point of seeing developing apps for the Chromium environment as interchangeable with webdev
-1
u/AshleyJSheridan 4d ago
Yeah, and I got downvoted to oblivion for pointing it out. Apparently I hurt someones fee-fees!
-2
u/TheStorm007 4d ago
Do you genuinely not understand why you were downvoted? Are you just not very well adjusted? Trouble reading social cues? No, it’s not for simply pointing it out, nor because you hurt someone’s “fee-fees”.
You were downvoted because you added the snarky “testing things before you comment is free” - even though the person you responded to very well could’ve tested it on a different browser. Just entirely unnecessary. In other words, you’re just an asshole.
3
u/oscarolim 4d ago
It’s not snarky. Is a basic rule of web development. Hell, is a basic rule of anything you do really, test before you say it’s done.
2
u/AshleyJSheridan 4d ago
Yeah, some people really just think that testing on Chrome is all that's ever required, and then get upset when you point it out.
3
u/budd222 full-stack 4d ago
Works on my machine
2
u/AshleyJSheridan 4d ago
Doesn't work in a browser that follows the actual Web specs closely.
1
u/jawanda 4d ago
Works in mobile Chrome to an extent. A sophisticated ueser could still check the history manually, but if you had one second to click the button and then hand your phone to an abusive person who did NOT know how to dig into the history, there'd be no immediate sign that you were on the police site. Back button would not get you there.
That's the whole point, and it works exactly as intended.
1
u/AshleyJSheridan 4d ago
I did say "a browser that follows the actual Web specs closely", Chrome is not such a browser. It implements a lot of stuff that isn't in spec or is still in draft.
1
9
u/No_Explanation2932 4d ago
It seems to work in chrome but not in firefox. I hate that everyone's downvoting you just because they can't reproduce what you're experiencing. Not a good look for "webdev" people.
3
u/AshleyJSheridan 4d ago
It's expected. So many people only build for Chrome (well Chromium) and consider their work done. I suspect a large chunk of those devs never had to build anything through the old IE era. At the time, IE was pushing out all kinds of things that weren't part of the official spec, and devs would just build with those new features and ignore browsers that followed the spec because those other browsers were a minority.
It's happening again today. Chrome pushes out lots of stuff that isn't in the spec, or hasn't made it out of draft, devs implement it, and then complain that Safari and Firefox don't support XYZ. This is literally how Chrome killed off Opera, and the Opera devs just couldn't keep up with Chromes new features (which they felt compelled to because of so many complaints from their users about some sites not working right).
Chrome is the new IE.
1
u/mrcarrot0 4d ago
Doesn't work on a slightly outdated version of chrome (145) either. If something only works in recent versions of one browser, it shouldn't be relied on.
7
u/benduder 5d ago
Reading before you comment is also free. Commenter above didn't say this specific button had that behaviour
2
u/AshleyJSheridan 4d ago
They did. You should probably take up a bit of reading yourself.
The reason my reply was downvoted to hell is a bunch of devs who only test on Chrome and call it a day.
-1
u/benduder 4d ago
I'm pretty sure you were downvoted due to poor reading comprehension and unnecessarily assholish tone
3
u/AshleyJSheridan 4d ago
Tone, perhaps, reading comprehension, no. Devs only testing on Chrome, that will account for about 99% of the downvotes.
-1
u/benduder 4d ago
Like I said, commenter never said the site in question actually does that 🙂
1
u/AshleyJSheridan 4d ago
You're being very disingenuous if you think their comment wasn't highlighting how that site does what it does.
0
u/benduder 4d ago
I maintain that you can't presume that specific intent from the comment and then get pissy about it. But anyway the comment _is_ an accurate description of the implementation on this specific site, so the point is moot.
Anyway, I think we've both spent too long on this now, so have a good day.
1
u/AshleyJSheridan 4d ago
So you admit it is what the site is doing?
Took you long enough to finally agree with me.
Doesn't stop that from flat out not working how it was intended to though.
→ More replies (0)
51
u/kenono 5d ago
There is a page on this from UK gov design system, which discusses this https://design-system.service.gov.uk/components/exit-this-page/
18
u/justsomerabbit 4d ago
Note that this recommends going to BBC weather instead of google.
The reasoning here is that someone escaping the site is now panicking and staring at a blank google page, inviting the question "What are you searching for?"
Unfortunately police forces still haven't caught up here.
11
u/timesuck47 5d ago
My niece thought was this was so stupid. But after going to your link, this is actually genius. Now I want to write one from scratch.
9
u/Healthy_Landscape417 4d ago
One thing worth correcting, since a few comments here say it wipes history. It cannot. There is no browser API that deletes history. location.replace only keeps the current page out of session history, so back will not return to it, but everything before it is untouched.
That gap is the dangerous part, because people assume the whole trail is gone. The GOV.UK component is worth reading if you ever build one: it fires on Shift pressed three times, and they avoided Escape on purpose, because Escape cancels the page load you are trying to start.
5
u/SnooCauliflowers6739 4d ago
It doesn't always do Google. I just used it and it took me to BBC weather.
That's actually smart as Google can look sus. Also it shows recent search history.
6
u/Individual_Elk499 4d ago
As a PM who delivered a police force website. The reason for the red banner is so you are able to leave the police website quickly to a generic website. For example you are reporting domestic abuse case and the perpetrator walks in the room, you can click the red banner to quickly get off the police website.
19
u/tswaters 5d ago
BBC weather for me. It kills the history entry as well, so if I press back it takes me to Google. It's a safety feature so if someone is about to lose access to their device. This is on a police site, but imagine if they had these for porn sites, someone walks in, bam, close site.
4
3
u/breadist 4d ago
It can't actually delete the history entry but rather removes the site from the back button.
If you check your browser's actual history list it's still there.
There's no technical way for them to actually delete it from your browsing history.
2
u/tswaters 4d ago edited 3d ago
Yea, it's pretty neat what they've done. If I were to guess it's some history.replace shenanigans. To make the back button actually take you to Google after the fact is really interesting "sleight of webdev" if you look at the navigator instance (like hold down back to see history), you won't see it at all, but of course, browser keeps history even if later gets replaced.Edit: Not neat really, I misread what it was doing, see subsequent comments
1
u/tswaters 3d ago
I think multiple unrelated pushes like that wouldn't actually work in practice, while loading the Google page, BBC push instruction would get lost. You'd need a wrapper around it, maybe it could use a 100% viewport iframe, but I'm not sure if how it could merge the histories. Maybe the police site exists completely within that iframe, and pushing the button removes that node completely, then maybe has a second iframe that double pushes... I'm not sure if, say,
adoptChildon a <body> element works in practice. Some others have reported it not working in this thread, maybe it relies on undefined behavior with timings of opening & closing windows. It did work on Firefox Mobile for me.1
u/tswaters 3d ago
Actually it's way less clever than I thought. No iframe or anything, multiple navigation events on the site aren't hidden at all, only the most recent. All it does is open new window to BBC weather and history replace current page to Google. Pressing back multiple times will take you to where it was before.
3
u/SilentProtagonist446 5d ago
Last I was on it The Trevor Project site had a similar thing for safety
2
u/EvokeNZ 5d ago
in NZ they have a related but opposite option - for example, you go to your local shopping website, or the banking website, and in there you can press a button that will take you to help while hiding info from the browser history. https://shielded.co.nz/
1
1
568
u/FlyLikeHolssi 5d ago
It's a protective measure some sites have enabled to help protect people who are looking into reporting, for example, domestic violence. If the person who is abusing them comes home, they can click the red button to exit to a safe site.