Wikipedia:Reference desk/Archives/Computing/2017 March 13

= March 13 =

Where did this ad web site come from?
From Wikipedia I went to the Henry comic strip here. I didn't click on anything that would lead me here.

Instead, I clicked on "Mark Trail" in the list of comic strips and clicked on the "back" button to get back to Henry. I did not go back to Henry until clicking again.— Vchimpanzee  •  talk  •  contributions  •  18:34, 13 March 2017 (UTC)


 * JavaScript on a web page can insert pages into your history so clicking the back button will go to the page they inserted instead of the page you used to be at. It appears one ad page was inserted so going back again got you back to where you were. 209.149.113.5 (talk) 18:45, 13 March 2017 (UTC)


 * I can't think of any legit reason to do this, so can Microsoft put out a fix to prevent JavaScript from modifying the history ? StuRat (talk) 20:49, 13 March 2017 (UTC)


 * This is not new. It has always existed and it is used for legit reasons. Example: You are looking at a photo album on my website. You click the button to enlarge a photo. That doesn't load a new web page. It just makes the picture larger. You then, instinctively, hit the back button to see the page before the enlarged photo - expecting to go back to the album. Instead, you go to the page before you looked at the album. So, as a fix, I insert the album in the history with no enlarged photos when you click the enlarge button. You click the back button and see what you expect to see. 209.149.113.5 (talk) 12:30, 14 March 2017 (UTC)


 * I see. Still, this doesn't seem important enough to let rogue sites mess with the history.  In the case you described, the back button would take you back a page, then you would just hit the forward button to return.  No biggie. StuRat (talk) 04:40, 17 March 2017 (UTC)


 * JavaScript can also turn normal web pages into redirects: when triggered by a pseudo-random number generator to prevent the site from being entirely unreadable, it's a fairly common tactic on sites put up for ad revenues, especially when the owners believe most customers will not stop viewing the site if they occasionally get redirected to an ad (porn sites, web comics, fan fiction and "listicles" sites are very common targets of this sort of advertising). ᛗᛁᛟᛚᚾᛁᚱPants   Tell me all about it.  19:01, 13 March 2017 (UTC)


 * If the web site owners are complicit, there doesn't seem to be a way around this short of avoiding those sites. StuRat (talk) 20:51, 13 March 2017 (UTC)


 * Well, that depends on how they're doing it. If the only JS on the page is the code that does this? Just turn off JS for that site (or session, or browser, whatever). But JS is the simplest and easiest way of doing this. If they did it with a server side script, then yeah, there's nothing for it but to stop visiting or learn to love redirect ads. ᛗᛁᛟᛚᚾᛁᚱPants   Tell me all about it.  21:56, 13 March 2017 (UTC)


 * Don't those sites which use JavaScript for that purpose make their site unusable without it ? For example, it might say "Click here for a picture of Michael Jackson's nose", and if you click you take your chances.  If you disable JS, then you never get to see what you want. StuRat (talk) 22:35, 13 March 2017 (UTC)


 * Some do, yes. I disabled JS on a webcomic site I was following once and it successfully solved the problem. To be fair, this was about 6 or 7 years ago. It really all depends on who wrote the site and how competent they are. I once found a site that used JS to run a login portal. Usernames and passwords were in a pair of arrays right there in the header of the login page. Needless to say, I used every account on the site to send the admin one-word emails which, when put together, said something like "Your security sucks. Here's why: [70 or so words of sarcastic criticism]." ᛗᛁᛟᛚᚾᛁᚱPants   Tell me all about it.  22:40, 13 March 2017 (UTC)