I want to find the previous Get request from browser history using javascript
Asked
Active
Viewed 2,904 times
1 Answers
0
You cannot access the browser history using javascript, it is usually blocked by the browser. You can however use some APIs provided by some browsers in order to get the history.
Access my entire browsing history via Javascript
Now since you asked for only the previous get request, the simple logic would be to write a tracing code within your httprequest function

Rohit Pothuraju
- 83
- 6
-
Cant i access it through java script history object – Nadym Baba Jun 07 '17 at 07:13
-
Probably yes, but the window.history.forward() or window.history.back() will implement on the current window. If you just want the url of previous request then this would be wrong, this will actually take you to the previous url – Rohit Pothuraju Jun 07 '17 at 07:19
-
Actually the browser.go() takes number and url as arguments...I wanted to find a way around to pass request type and Url – Nadym Baba Jun 07 '17 at 07:26
-
So do you want to enter that url or do you want to just know the url of previous get request? – Rohit Pothuraju Jun 07 '17 at 07:29
-
a part of url then it will take automatically the GET request which matches as explained here [link](https://www.w3schools.com/jsref/met_his_go.asp) – Nadym Baba Jun 07 '17 at 08:45
-
Then you can go with either, I still suggest you use a tracking logic but you can use this method as well. It is up to you. Did you try and get any error? – Rohit Pothuraju Jun 07 '17 at 08:49
-
But this method takes no of pages as argument but i want to pass Type of request as argument – Nadym Baba Jun 07 '17 at 08:56
-
That is not possible as you need to access the XMLHttpRequest object in order to know whether it was GET request or POST request. This method does not do that I think. Can you send me the browser.go() method url I can't find it – Rohit Pothuraju Jun 07 '17 at 08:59