JavaScript - How To Use History And Referrer In Framestructure?
Hi all,
I have a frame structure (three frames) where the top one is my flash navigation. The navigation itself is quite complex so I have given up on the idea of creating a back button code to control the flash. All I want to do now is to refresh the flash page when browser's back button is pressed. What I would like to do is to set a variable of the previous page I just have been so when I hit browser's back button I know if this page is the same as the variable. In each individual page i would set the varaible to be the previous page. Here are few things I have tried so far and none of them seems to work (even online!) (sections is the name of the main frame) old_page = parent.sections.history.previous; old_page =document.referrer; I tried both of them at the beginning of each page. then used onUnload command in the body tag to call a function on another frame where I have the comparison: function check_history(old_page){ if (old_page == parent.sections.location){ alert(" refresh flash"); } If I use referrer, the value is null (empty) or if I use history the variable is undefined. Has anyone come accross with anything similar? Thank you very much for your help. Similar TutorialsA little question: Which referrer gets facebook if I make a getjson to https://graph.facebook.com/someid?callback=? Does facebook get as http referrer the client or my server? Any help would be awesome and much appreciated! I'm trying to change an id by referencing the previous site the user was on. In this case the user will be coming from either facebook or linkedin. I'm not sure if i'm calling the referrer property correctly. Again, any help is greatly appreciated! <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>Untitled Document</title> <script language="JavaScript"> if(document.referrer.toLowerCase().indexOf("facebook") != -1) { document.getElementById("phone").innerHTML = "555.555.5555"; } else if (document.referrer.toLowerCase().indexOf("linkedin") != -1) { document.getElementById("phone").innerHTML = "222.222.2222"; } else { //Default code } </script> </head> <body> <p id="phone">123.456.7890</p> </body> I have used this script successfully: http://www.javascriptkit.com/script/...2/refer2.shtml However, is there a way to block the following work-around (example only): http://www.their-url.com/redir.php?u...ww.my-url.com/ The redir.php makes it possible to get past the script. this is prob more simple than im thinking but i cant grasp it at the moment.. on the process page for my site, it has a link to view the account i click on that link and then i can click the back link to go back.. when i do, i get a page has expired message the reason is because the original link there is Code: http://www.xxx.com?ms=1 and that ms1 no longer exists after i leave the page because i unset it. once i leave that page so im curious is there a way to have the main url Code: http://www.xxx.com as the referrer when i click on the link so that when i use the back link Code: <a href="javascript: void(0)" onClick="javascript:history.go(-1)">Go Back</a> it can go back to that main page url instead of tring to find the one with ms1 on it.. i just realized i should have posted this is javascript sorry im tired lol Hello, I have very little knowledge of javascript, other than modifying existing scripts, and I can't find anything about this particular problem. I need some help on creating a simple script that will display a div ONLY if the user comes from a certain page within the same site. Not sure if that was clear, but let me try with specifics. There is a link to a page called 'Clients' on the 'About Us' page. If a user goes directly to 'Clients', they should have a normal experience. If, however, they come via the 'About Us' page, I want to display a div at the bottom of the page that will take them back to the 'About Us' page. I know how to get a referrer, and I know how to show/hide divs. I just don't know how to combine the two. Can anyone help? Hi all, first post and a bit of a newb, so please be gentle I have a file that generates web galleries in Adobe Lightroom. They are generated depending on which files are selected and the metadata in those files. Basically it is a series of pages of thumbnails called index.html index_1.html index_2.html etc. Then a set of pages for each individual image. An example can be seen he http://68.169.32.107/jonrouston/clients/su-dathan/ (the page navigation links are not great, but I have addressed that, they're at the bottom >> ) Currently if a user clicks on a photo there is a 'return to thumbnails button at the top, but this always takes them to /index.html So the user could be at a picture after browsing to /index_39.html and still get returned to /index Is there any way I can use history.go to find the last instance of index.html Or index_x.html (where x is any number) and take them back to that instead? Thanks for any help Jon Overview: Order entry project. I am using an iFrame to pull external forms that I can not change. Once our employee enters in the information and submits I would like to redirect the existing window to a new page. I've tried many variations of: Code: <script type='text/javascript'> function iHistory() { var hist=history.length; if (hist>1) { parent.window.location = "orderentry.php"; } } </script> Since I have no control of the external form I have been using OnLoad() in the iFrame tag to call iHistory(). The script works great unless the browser history is >1 If possible, I would like to also setup like a 5 or 10 second delay so the employee can see the framed confirmation page before redirect. So the function needs to check current history.length, when that changes delay 5-10 seconds and redirect parent window to orderentry.php Hiya was wondering if someone can help me with this: basically i'm trying to create a Back button for a report page. the first report page is a listing of dates... if i click on a date... it will open up a page with detail. I want to put the history.go on the page with detail to go back to the date listing page. obviously the page with details has page numbers. i already added a counter for clicking on the [previous] or [next]. i'm thinking of just using that click++ value and put the value on the var within history.go(var) Code: var clickCount = 1; function addcount() { a = clickCount++; return a; alert(a); } <a href="javascript:history.go( dunno what to put here )">Back</a> <a href="abc" onclick="addcount()">Previous</a> <a href="def" onclick="addcount()">Next</a> possible? or is there a better way to do this? no direct url won't work. I know that Javascript cannot look at the URLs in the browser's history object. I am not concerned with the content. I have a page that is a serious problem when user's hit the BACK button and get to it because it causes a ping-pong affect of going back, and then loading the next page again (and again and again) each time the user hits back. Is there any way to know if the page being displayed is not the last page in the history? If I can see that it is not the last page then I can send the user to the correct page instead of just pushing them forward. THANKS! I am not sure if this has been posted before but I need help with this. When a user clicks on the back button I need them to be directed to the previous page and still have their original selections and not the defaults. Here is the rest of code on the back button. At the moment this is not working. <input id=STDBUTSHORT type="button" value="Back" onClick="history.back();">') Thanks in advance. I am using a Jump Menu: Code: function MM_jumpMenu(targ,selObj,restore){ //v3.0 eval(targ+".location='"+selObj.options[selObj.selectedIndex].value+"'"); if (restore) selObj.selectedIndex=0; } function MM_findObj(n, d) { //v3.0 var p,i,x; if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) { d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);} if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n]; for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document); return x; } function MM_jumpMenuGo(selName,targ,restore){ //v3.0 var selObj = MM_findObj(selName); if (selObj) MM_jumpMenu(targ,selObj,restore); } Code: <form name="FrontPage_Form1" language="JavaScript" onsubmit="return FrontPage_Form1_Validator(this)"> <!--webbot bot="Validation" b-disallow-first-item="TRUE" --><select name="menu" class="TextArea" onchange="MM_jumpMenu('self',this,0)"> <option value="javascript:myVoid()" selected>Choose One </option> <option value="1.html">One</option> <option value="2.html">Two</option> </select> </form> Is there some way to make such a jump menu observe the history, so that going back will go back to the page containing the form? Hello all is there any way to get browse history list ? with java script ? I need an html page that when visited automatically redirects the browser to return to the previous page it was on. here is the current code I have: Code: <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> <title>Untitled Document</title> <script type="text/javascript"> function load() { history.go(-1) alert(""); } </script> </head> <body onload="load()"> <input type="button" value="Back" onclick="goBack()" /> </body> </html> this works in firefox but in IE you have to press ok in the alert box before it returns. I admit I am a javascript novice. Any suggestions Hi,
I have a form in my site.when the form is submit successfully it's go to another page, which shows "submission is success".
and that page has a link to go back to a page which is viewing previously(before to form)
this is the code for it Code: <a href="javascript:history.go(-2)">Go back to previous</a> I want to know, how to go to previous page by automatically ??? this should be happen after 10 seconds! please help me.... I currently use this type of code on my "Processing" page: Code: <META content="2; url=../" http-equiv="refresh"> I am wondering if its possible to use like JavaScript history to go back? Code: <SCRIPT type="text/javascript"> setTimeout(2000) { history.back(); } </SCRIPT> The above is a bit of a guess. Can something be done like that? I have a stupid problem... Page 1 and Page 2 have a link to Page 3 Page 3 is a html page, the frame source is Page 4 There is a javascript:history.go(-1) link on Page 4. I want to go back to page 1 (not inside the frame, i want it to go back to the previous page just like when you click the "back" button of your browser) or go back to page 2 (whichever one is the last page) but the link doesn't work because it's inside a frame... If i go directly to page 4 without using the page with the frame (page 3) the link will work and get me back to page 1 or page 2... some help would be appreciated !! Hi I am using back button with javascript:history.back(); on it but the page I want to go back have anchor link smth like: http://example.com/index.php#anchor_link How do I go back ? I've tried javascript.history.go(-1); a Hi, I need a javascript function to show and allow user to access Browser stored Favorites and Recent History in a web page. Thanks, GravityPush I've been working on a site where the content is displayed in an iframe. The iframe content is on a different domain than the iframe itself. I've already got around the cross-domain problems by creating a file on the parent domain that the iframe content references via another iframe. (which uses parent.parent to skip the permissions issue) That was all fine and pressing back and forward in the browser navigated back and forward in the iframe (at least in FF, not 100% sure about other browsers) Then the client wasn't happy that the url in the browser didn't change and pages couldn't be bookmarked. So I created a solution where the parent.parent.location.href was changed to be domain.com/#/path/to/iframecontent.php so that pages could be bookmarked, that works fine but now back and forward don't work, or more specifically the url changes correctly but the iframe content doesn't go back. how i can refresh my main history page without page refresh alert message? i am using the following code on the submitpage.asp <%response.write ("<script>window.location.reload(history.go(-2));</script>")%> i got the attached message when it refreshes the main page. is there is a way to refresh directly without this message? |