A Flash Developer Resource Site

Results 1 to 12 of 12

Thread: browser back command

  1. #1
    Junior Member
    Join Date
    May 2002
    Posts
    12
    Is there a way to invoke the browser 'back' command from within a .swf? Does it require an FS command action, and if so can someone show me how the sripting for this command is done?

  2. #2
    Senior Member Cadence's Avatar
    Join Date
    Aug 2000
    Location
    Columbus, Ohio
    Posts
    3,428
    Yes, you can .... There are a couple ways you can do it ..


    You can set up your button like this :

    OnRelease
    --- javascript
    --- history.back()


    Or ...
    OnRelease
    --- GoTo URL
    ----- javascript:history.back();


    To go forward :

    OnRelease
    --- javascript
    --- history.forward()


    Or, to define how far back or forward they go :

    OnRelease
    --- javascript
    --- history.go(#) (a positive number will send them forward, a negative number will send them backward)


    Hope it helps,
    Peaces,
    Cadence

  3. #3
    Junior Member
    Join Date
    May 2002
    Posts
    12
    Thanks for the browser back jscript action command.

    A glitch I'm not sure how to resolve is that it takes two mouse clicks to invoke the action. I tried setting this up through either 'on press' and 'on release'.

    Same result using jscript or URL commands. Also same results using history.back() and history go()commands.

    Thanks for any help you can provide.

  4. #4
    Junior Member
    Join Date
    Aug 2003
    Posts
    9

    JavaScript history.back() 2 mouse clicks

    Was this problem ever resolved. I have been scanning the forum and have no seen a resolution for the 2 mouse click problem when using the javascript history.back(). I too am having the same problem.

    Thanks
    Paul

  5. #5
    Flashkit historian Frets's Avatar
    Join Date
    Oct 2000
    Location
    flashkit
    Posts
    8,797
    Yes use two events for the same object

    OnPress
    --- javascript
    --- history.back()
    OnRelease
    --- javascript
    --- history.back()

  6. #6
    Junior Member
    Join Date
    Aug 2003
    Posts
    9

    JavaScript -- History.Back Quirk??

    Hi Frets,

    Thanks for the clarification on the two events. It resolved the issue but with a small quirk. I am new to javascript and swish so I am not sure if it is a bug, quirk or the way I am manipulating my object.

    I have an arrow that I am using for a next button and a back button. I am using a gotoframe routine to give each arrow a ccw rotation effect.

    The problem I am having is when I advance from my Products 1 Page to Products 2 Page and then try to completely back out of all my products pages using the Back Arrow.

    Products 2 Page has the same exact back arrow using the JavaScript:history.back(); fuction. It always brings you back to the products 1 page.

    BUT when I try to go from Products 1 Page to the main proucts page, it refreshed Products 1 Page every time. I can break the loop by using the browser back button.

    What is really funky is if you go from the products main page to Products 1 Page and then use the Back Arrow, it works fine every time. It only fails to work when yuo click the next arrow and try to back out completely.

    You can simulate this problem by following this link.

    http://www.amuseaz.com/products/products.html

    Click on Bounces Tab.
    Click Back Arrow --- Should work fine.

    Click on Bounces again. Click on Next Arrow ---

    Click Back Arrow and then Back Arrow again and you will see the loop.

    You can download the actual swish file from here

    http://www.amuseaz.com/BackFlash.swi
    http://www.amuseaz.com/BounceProductsFlash.swi
    http://www.amuseaz.com/BounceProductsFlash2.swi


    I hope this is not too confusing. I have tried to explain it as clearly as possible.

    Thanks.

    Paul
    Last edited by azpaul; 09-07-2003 at 11:55 PM.

  7. #7
    Flashkit historian Frets's Avatar
    Join Date
    Oct 2000
    Location
    flashkit
    Posts
    8,797
    Well the swf refreshes on each page.

    So there's no way to lay cookie crumbs thru it.

    What you could do is either simply use direct go to url
    and forget history back for your links

    Or you could script the page to go to a specific
    frame of the movie

    <body onload=javascript:movieName.TGotoFrame('SpriteName ',15);>

    Or you could call the back action via javascript in swish
    to javascript function in the head

    something like
    On Event
    javascript
    MyBack()

    Then in the head of your html document you'd need to create
    a back script
    something akin to

    Code:
    <script language="JavaScript"> 
    function MyBack() 
    { 
    history.back(); }
    </script>
    Frets

  8. #8
    Junior Member
    Join Date
    Aug 2003
    Posts
    9

    History.Back Refresh

    Hi Frets,

    I do not understand the syntax of the onload mavie.name method so I could not try that one.

    I did try the MyBack() funcion and it did not change. It behaves identical. Why is the swf refreshing? I would like to understand what is exactly happening. I am wonder too if has something to with jumping from frame to frame?? I believe if I use a stationary object it will work fine. I am going to try that next.

    I could not find any other way to rotate the object through the OnPress Event.

    Is it acceptable to use static links on the back navigation buttons? I would think one would want to use the history function incase the products page was pulled from a search engine or similarly linked??

    Paul


    Well I was Wrong... The stationary object behaved the same way and refeshed the page.... I am stumped??
    Last edited by azpaul; 09-11-2003 at 12:51 AM.

  9. #9
    Flashkit historian Frets's Avatar
    Join Date
    Oct 2000
    Location
    flashkit
    Posts
    8,797
    When ever you reload a page you need to reload all the content
    within the page. Even though the swf is stored in the cache.

    It's not like an open xml socket

    Have you tried manually deleting your swf from the cache?
    You may not be recieving the new swf because the browser
    thinks the file is already stored.
    This is common.

    body onload means once the page is loaded automatically
    perform said javascript with out having to insert a
    onclick javascript function.

    What could be occuring is the swf is not loaded enough
    to perform the onload action.

    If that is occuring you would need to script to insure
    that the swf is loaded fully before envoking a javascript
    For more on that read The Definative Guide

    Frets

  10. #10
    Junior Member
    Join Date
    Aug 2003
    Posts
    9
    I guess I can use the static links on the back buttons but I am not sure if it is "Proper". There are probably different views on this.

    I will read the Definative Guide and see if I can make heads or tails from it.

    What really baffles me is that my apache log does not show the refresh so it is comming from cache. I am sure the new swf file is getting loaded because I removed the cw rotation and it is dod not rotate on the page when clicked. I can paste the page URL in the address bar and it works fine everytime until I go to the nextpage and then come back out.

    Are there any debugging tools available that can show me what is happening when the event occures. I have used display boxes in the past to show variables and history.back() might show a variable value.

    I really like the rotation effect and would like to keep it if possible and if that means using a static link then I guess that is what I must do.

    Thanks.

    Paul

  11. #11
    Junior Member
    Join Date
    Aug 2003
    Posts
    9
    I have been doing some more testing with this issue. I am wondering now if it is a bug with in swish???

    Here is what I have seen.

    I start at my products page and use the swish animated arrows.
    I watch my history by clicking the down arrow next to the back button on explorer after each page is loaded.

    I can see each page load in to the history. All fine and as expected.

    Main Page
    Products
    Bounce

    On my last product page, I will name bounce2 I see bounce in the history which is the correct url to go back to.

    I click the back arrow and bounce is not replaced in history list with products, there for causing the loop effect. Bounce just stays there. So, bounce is then never replaced in the list with the previous as it should. This causes a refresh appearance!

    Now, I performed the same test using the browser back button.

    Each list item was replaced with the previous and there are no navigation issues.

    I have read the Definitive Guide and tried the I Movie Loaded Check Script.

    The animated buttons behave the same.

    This is why I am thinking it is a swish bug. The history.go(-1) I am using is working exactly as it should based on the history list it is pulling from...

    Your thoughts on these new results...

    I am a novice javascript, html and swish writer so I do not know if it is something that I am doing. I really don't think so but hey, who knows.

    Paul
    Last edited by azpaul; 09-16-2003 at 01:17 AM.

  12. #12
    Flashkit historian Frets's Avatar
    Join Date
    Oct 2000
    Location
    flashkit
    Posts
    8,797
    copied from swishzone

    It's not a bug.

    All this time all all that needed to be done is identify
    the window/location.
    either by _parent or by window

    window.history.back()

    http://frets-files.com/back/page1.html


    Frets

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  




Click Here to Expand Forum to Full Width

HTML5 Development Center