dcsimg
A Flash Developer Resource Site

Results 1 to 18 of 18

Thread: add to favourites

  1. #1
    Junior Member
    Join Date
    Mar 2001
    Posts
    9
    I'd like to have a flash button to enable users to add my site to their bookmarks/favourites...does anybody know if [or how]there is any actionsript or javascript that i can assign to the button to enable them to do this?

    Any help appreciated

    Chris

  2. #2
    Owner of the thread tublu's Avatar
    Join Date
    Nov 2000
    Posts
    2,430
    it would be done by the javascript .

    here you are http://www.javascriptsource.com/page...-favorite.html

    you can find more of the same in the same site ... search by bookmark
    [Edited by tublu on 08-24-2002 at 03:22 PM]

  3. #3
    Junior Member
    Join Date
    Mar 2001
    Posts
    9
    Thanks for the javascript but how could it be incorporated in to the flash button so that clicking it made the action?

    Chris Jones

  4. #4
    Senior Member
    Join Date
    May 2002
    Posts
    253
    on (release) {
    getURL("javascript:window.external.AddFavorite('yo urPage.html','BookmarkName');");
    }

  5. #5
    Junior Member
    Join Date
    Mar 2001
    Posts
    9
    Brilliant guys, thanks for the help....

    Chris

  6. #6
    Senior Member catbert303's Avatar
    Join Date
    Aug 2001
    Location
    uk
    Posts
    11,222
    A small extra

    Since add favourite only works for internet explorer it's a nice touch only to display the add favourite button if the user has IE. You can do this by placing the button (as coded by TranslucentDesign in a movie clip) and making this visible dependant on browser type. you can let flash know this with some javascript like this

    Code:
    <script language="javascript">
    <!--
    var userAgent = navigator.userAgent.toLowerCase();
    var version = navigator.appVersion;
    if (userAgent.indexOf("msie") != -1 && parseInt(version) >= 4) {
      favourite = 1;
    } else {
      favourite = 0;
    }
    document.write('<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=5,0,0,0" id=main width=550 height=300>');
    document.write('<param name=movie value="filename.swf?favourite=' + favourite + '"> <param name=quality value=high> <param name=bgcolor value=#ffffff> <param name="menu" value="false">');
    document.write('<embed src="filename.swf?favourite=' + favourite + '" quality=high bgcolor=#ffffff name=main swLiveConnect=true menu=false width=550 height=300 type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash"></embed>');
    document.write('</object>');
    //-->
    </script>
    now in flash if the variable favourite is 1 you can make the clip containing the button visible, otherwise you could display a message saying something like press Ctrl + D to bookmark

  7. #7
    Member
    Join Date
    Jul 2002
    Posts
    72
    Catbert, the AddFavorite works when I go through the swf directly but when going through an html, that bookmark button won't work. Any guesses?

  8. #8
    Senior Member catbert303's Avatar
    Join Date
    Aug 2001
    Location
    uk
    Posts
    11,222
    What browser do you use? The javascript is designed to prevent the add favourite button showing if you don't use internet explorer 4 or higher, (since it is the only browser that allows add favourite) I used this on my homepage (please don't laugh it was a 10 minute job ) see if the add favourite works on that, if it does you can view the source of the page to see the javascript code and if you like I can send you an fla file which contains the button.

  9. #9
    Member
    Join Date
    Jul 2002
    Posts
    72
    Good question - I just tried this in an IE5 browser with no issues. This doesn't seem to be working in IE6 with all the latest patches. Perhaps it was disabled with the latest security patch?

  10. #10
    Senior Member catbert303's Avatar
    Join Date
    Aug 2001
    Location
    uk
    Posts
    11,222
    Possibly, I don't have IE 6 so I can't test it, could you do me a favour copy and paste this code into notepad (or whatever editor you use) and run it in IE 6 and post screen output back here,

    <html>
    <head>
    <title>browser check</title>
    </head>
    <body>
    <script language="javascript">
    var userAgent = navigator.userAgent.toLowerCase();
    var version = parseInt(navigator.appVersion);
    document.write("user agent string: " + userAgent + "<br />");
    document.write("version: " + version);
    </script>
    <a href="javascript:window.external.AddFavorite('this page.html','bookmrk');">click here to bookmark</a>
    </body>
    </html>

    And see if clicking the link works or not, I'd like to see if it's the javascript that isn't working in IE6 or something in the flash.

  11. #11
    Member
    Join Date
    Jul 2002
    Posts
    72
    Thanks for the help!

    user agent string: mozilla/4.0 (compatible; msie 6.0; windows nt 5.1; .net clr 1.0.3705)
    version: 4 click here to bookmark

    Down at the bottom of the IE browser window frame, you can see a message: error on page.

  12. #12
    Senior Member catbert303's Avatar
    Join Date
    Aug 2001
    Location
    uk
    Posts
    11,222
    Thanks

    It's interesting parseInt(navigator.appVersion) appears as 4
    Does clicking the link do anything?


  13. #13
    Member
    Join Date
    Jul 2002
    Posts
    72
    the only thing I get is - Down at the bottom of the IE browser window frame, you can see a message: error on page.

  14. #14
    Senior Member catbert303's Avatar
    Join Date
    Aug 2001
    Location
    uk
    Posts
    11,222
    Hmmm, maybe they have removed the add favourite feature, seems quite unlike microsoft to do something security concious
    Thanks for your help

  15. #15
    Member
    Join Date
    Jul 2002
    Posts
    72
    No, thank you! I appreciate the time you took to look at this. This is getting frustrating. First it only worked in IE, now with the latest patches, it only works in IE5 - theres got to be a way to make a bookmark work in flash!

  16. #16
    Senior Member catbert303's Avatar
    Join Date
    Aug 2001
    Location
    uk
    Posts
    11,222
    Oh, I just had a quick thought (that type of thing doesn't happen every day ) make sure instead of something like pagename.html you put the full url of the page that you want bookmarking eg

    http://www.mysite.com/mypage.html

    so in flash try something like

    on (release) {
    getURL("javascript:window.external.AddFavorite('ht tp://www.mysite.com/mypage.html','my site');");
    }

    test this online and hopefully it'll work in IE 6

  17. #17
    Member
    Join Date
    Jul 2002
    Posts
    72
    Sorry - no luck - I also tried -

    //getURL ("javascript:window.external.AddFavorite('http://www.youraddress, 'yoursitenamehere')", "", "GET");
    //getURL("javascript:window.external.AddFavorite('ht tp://www.whatever.com/whatever.html" add _level0.URL add "','" add _level0.Title add "')");

    The issue appears to be an IE6 thingy.

  18. #18
    Member
    Join Date
    Jul 2002
    Posts
    72

    Closer to figuring it out

    OK - I've done some more research - the issue is that this code works with IE5 when using a URL redirect service but for some reason it won't when using a url redirect service in IE6


    I've read some articles on javascript being able to get around javascript redirect issues but I don't know enough to get it to work.

    response.encodeRedirectURL(request.getContextPath( ) +
    "/RegistrationServlet?cmd=login

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