homepage Welcome to WebmasterWorld Guest from
register, free tools, login, search, pro membership, help, library, announcements, recent posts, open posts,
Become a Pro Member
Home / Forums Index / Code, Content, and Presentation / JavaScript and AJAX
Forum Library, Charter, Moderator: open

JavaScript and AJAX Forum

GET /javascript:history.back(1)
To what end?

 2:07 pm on Aug 21, 2003 (gmt 0)

(Rude, or otherwise ignorant responses will be summarily ignored.)

Q: Why would this line "GET /javascript:history.back(1)" show up in access_log files as a 404?




 2:18 pm on Aug 21, 2003 (gmt 0)

Could it be that the page that contains the javascript was accessed directly
when opening the browser; not having any page to go back to?

Or the back page might have timed out?


 2:22 pm on Aug 21, 2003 (gmt 0)

Hmmm... really tempting to say "Rude, or otherwise ignorant posts will be summarily ignored" Hehehe ;)

But to be more helpful, the answer is that the page can't be found ;) and should never have been requested. The question is not why is it showing up in the logs as 404, but why is it showing up at all. Instead of requesting the page "/javascript:history.back(1)", the browser client should have interpreted the javascript statement, and requested the page's url. So you probably have a bug in the javascript of the page (or a buggy browser).


[added: Oops, I posted before refreshing my browser, so i thought my post would be #2... My first comment (the bit of levity) was not refering to fashezee's post in any way)]

[edited by: ShawnR at 2:34 pm (utc) on Aug. 21, 2003]


 2:25 pm on Aug 21, 2003 (gmt 0)

Oops, ShawnR got it first.

Yep, the parsed js should be reflected in the GET. And for pages accessed directly with no history the script simply does not execute and doesn't whow up as an entry in the logs.


 4:04 pm on Aug 21, 2003 (gmt 0)

The other option is that somewhere on your site you have:

<a href="/javascript:history.back(1)">back</a>

What UA is associated with this log entry?


 4:32 pm on Aug 21, 2003 (gmt 0)

It can also happen when user opens a page in a new window from javascript link


 5:17 pm on Aug 21, 2003 (gmt 0)

It can also happen when user opens a page in a new window from javascript link

I never realized that, didn't ever think to test it. I've never seen any except the standard 'back' scripts. Do you happen to know if there are any that take this into account? Or if it's something that just has to be lived with?



 5:48 pm on Aug 21, 2003 (gmt 0)

The "/" char. is not an escape; it is treated as a valid file character. Someone was playing around in the address bar and didn't delete the "/" so the browser didn't know it was JS and requested it as a filename. That would be my guess.



 6:38 pm on Aug 21, 2003 (gmt 0)

You could use <!--#echo var="REFERER"--> and place it in the "href" section. But if user has disabled referer then you are out of luck. IMO just leave it up to the user and standard browser interface.

"/" char comes naturally with HTTP request, that is the way HTTP works.

GET / - gets the root of the server

You can't request "GET mypage.html" - there has to be a full path to the root of the server. I am assuming you had a link that was using javascript and when user clicked it, browser thought it was originated from the root and added a slash in front of it for a valid HTTP request.

Global Options:
 top home search open messages active posts  

Home / Forums Index / Code, Content, and Presentation / JavaScript and AJAX
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Home ¦ Free Tools ¦ Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About ¦ Library ¦ Newsletter
WebmasterWorld is a Developer Shed Community owned by Jim Boykin.
© Webmaster World 1996-2014 all rights reserved