473,396 Members | 1,997 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

program browser back button to redirect to different page

Hi,
i'm designing a website with a gallery whose images contain anchors and records the location whenever a picture is viewed for example if the current picture is #pic1 then the url would be www.website.com/gallery/album1#pic1 , if i click on pic7 the url would be www.website.com/gallery/album1#pic7 and so on.. i did this so that when the url is copied and pasted the gallery would still show the last viewed image. my problem now is when i click back in my browser, the browser goes back to the previous picture not to the album, like if in the previous example if im still at pic7 the back button will take me to www.website.com/gallery/album1#pic1 instead of www.website.com/gallery
so my question is how can i program the browser back button to go back to the gallery immediately?
this is what i tried but it isnt working..
Expand|Select|Wrap|Line Numbers
  1. <html>
  2. <head>
  3. <script type="text/javascript">
  4. function backToGallery()
  5. {
  6. if(window.history.previous)
  7. {window.location.href='gallery.html';}
  8. }
  9. </script>
  10. </head>
  11. <body onunload="backToGallery()">
  12. </body>
  13. </html>
  14.  
Aug 10 '14 #1
0 1284

Sign in to post your reply or Sign up for a free account.

Similar topics

1
by: lpatel | last post by:
During a Script session, when I hit the browser 'Back' button I get Pag error. I get this error only from a couple of the pages. Would anyone what the problem could be? or how to go about fixin...
2
by: Freddy | last post by:
Hi, The registration process in our web site is of 3 step process spanning 3 pages and it is performed on https. I have noticed in some websites while doing credit card payments if we click...
0
by: neeraj | last post by:
Hi Everybody I have one problem in my asp.net web application. The problem is that I check the date validation in code behind; if user not gives the valid data and press save button then I fire...
5
by: ns21 | last post by:
How can the browser back button be disabled If the form is submitting information to other pages or submitting to itself or using redirections. I tried the tweaks like history.forward(1) in each...
7
by: nkodali | last post by:
Hi, I am having a signup.asp page where a user enters his details and clicks on subscribe button. I am doing server side validation to check if the user already exists in the database and then...
4
by: valhalen | last post by:
Hi, I am trying to redirect the user to another page (other than the previous one in the browser's history) when the browser's (IE's) BACK button is clicked. I found this snippet, but am finding...
2
by: Max | last post by:
I recently moved to ASPnet Ext 3.5 What I can't get with Ajax and History browser managemet is this: User fills some fields (dropdown and textbox) on page 1 (all are in an update panel) User...
4
by: shahidrasul | last post by:
hi in my project when i click on logout anchor it goes to logout page and my code in logout page is if (Session != null) { Session = null; Session.Abandon(); ...
2
by: =?Utf-8?B?SmVmZiBEb25rZXJzZ29lZA==?= | last post by:
I have a registration form that updates a province/state droplist when a country is selected from another droplist. When the user clicks the back button though, the province list goes back to the...
1
by: tuwanriyas | last post by:
Hi, My requirment is diable the "Browser Back Button" and create "Back Button" to go History -1. Actually I want to send user history back only through my "Back button". I could disable "Browser...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.