Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 13 of 13
  1. #1
    Senior Coder
    Join Date
    Aug 2002
    Location
    Kansas City, Kansas
    Posts
    1,518
    Thanks
    0
    Thanked 2 Times in 2 Posts

    Favelet in New Window Problems

    I wrote favelets for translating words from english to spanish and vice versa, but there seems to be a problem with them working when I open the result in a new tab or window. I'm doing this in Firefox. Any ideas?

    Code:
    javascript:
    window.location = 'http://www.dictionary.com/translate/text.html';
    var foo = document.trans_form;
    foo.lp.options[23].selected = true;  // [11] for english to spanish
    foo.text.value = '%s';
    foo.submit();
    Last edited by Antoniohawk; 01-15-2005 at 11:26 PM.

  • #2
    Banned
    Join Date
    Sep 2003
    Posts
    3,620
    Thanks
    0
    Thanked 0 Times in 0 Posts
    var foo = opener.document.trans_form;
    Or: opener.foo... ?????

  • #3
    Senior Coder joh6nn's Avatar
    Join Date
    Jun 2002
    Location
    72° W. 48' 57" , 41° N. 32' 04"
    Posts
    1,887
    Thanks
    0
    Thanked 1 Time in 1 Post
    can you give us the full bookmarklet? easier to figure out that way
    bluemood | devedge | devmo | MS Dev Library | WebMonkey | the Guide

    i am a loser geek, crazy with an evil streak,
    yes i do believe there is a violent thing inside of me.

  • #4
    Senior Coder
    Join Date
    Aug 2002
    Location
    Kansas City, Kansas
    Posts
    1,518
    Thanks
    0
    Thanked 2 Times in 2 Posts
    Sorry for not explaining it well enough guys, let me try again. I should have linked to [Custom Keywords] so that you guys would know what I was talking about. Hopefully that page explains it better than I could have.

    Instead of placing the value of %s in a url, I'm taking it's value and using it in a javascript since I can't find a url that will do what I want. So, my javascript essentially goes to the translator page of dictionary.com, places the value of %s in the form field and then changes the value in the dropdown box for the language that I specify. I guess that this will make a whole lot more sense if you go to the translator page and see what I'm talking about.

  • #5
    Smokes a Lot
    Join Date
    Jul 2003
    Location
    CA, USA
    Posts
    1,594
    Thanks
    5
    Thanked 20 Times in 20 Posts
    I see where you are going with this, perhaps using a form that doesn't use post would be easier? That way you could skip the form all together and just use the URL. I'm at work with IE so I can't test, but maybe try it with Yahoo?

    http://education.yahoo.com/reference...b=e&p=tomorrow

    Basscyst
    Helping to build a bigger box. - Adam Matthews

  • #6
    Senior Coder
    Join Date
    Aug 2002
    Location
    Kansas City, Kansas
    Posts
    1,518
    Thanks
    0
    Thanked 2 Times in 2 Posts
    Yeah, that's definitely a possibility, but I still want to know why mine won't work.

  • #7
    Smokes a Lot
    Join Date
    Jul 2003
    Location
    CA, USA
    Posts
    1,594
    Thanks
    5
    Thanked 20 Times in 20 Posts
    I was trying to do something similar a while back. From what I understand, you are running into the same problem I was. Trying to load the page, change the dropdown menu and submit the form all from the favelet, I too got it to work when I ran it from the page, but not when going from another page. Maybe I'm not getting the drift, but if it is the case, it was deemed not possible.

    Basscyst
    Helping to build a bigger box. - Adam Matthews

  • #8
    Senior Coder
    Join Date
    Aug 2002
    Location
    Kansas City, Kansas
    Posts
    1,518
    Thanks
    0
    Thanked 2 Times in 2 Posts
    Maybe my problem is the same as yours. When you use window.location, does it fully load the page and then continue on with the rest of the script, or does it go ahead?

  • #9
    Smokes a Lot
    Join Date
    Jul 2003
    Location
    CA, USA
    Posts
    1,594
    Thanks
    5
    Thanked 20 Times in 20 Posts
    I think what happens is that the body of the page has not yet loaded though you have changed the location, so you can't access the pages elements. This is just a guess based on what I was experiencing. Even if I opened it in a new window, put a setTimeout in, and tried waiting till the page loaded, I still had no luck.

    Basscyst
    Helping to build a bigger box. - Adam Matthews

  • #10
    Senior Coder
    Join Date
    Aug 2002
    Location
    Kansas City, Kansas
    Posts
    1,518
    Thanks
    0
    Thanked 2 Times in 2 Posts
    Is there anyway to use the onload method to see when it's done?

  • #11
    Senior Coder joh6nn's Avatar
    Join Date
    Jun 2002
    Location
    72° W. 48' 57" , 41° N. 32' 04"
    Posts
    1,887
    Thanks
    0
    Thanked 1 Time in 1 Post
    it looks like you're either running into the the no-cross-domain-scripting security feature, or youre running into the fact that javascript can't load a new page in the current window, and then manipulate that page. either way, Basscyst is probably right; using GET instead of POST is probably your answer
    bluemood | devedge | devmo | MS Dev Library | WebMonkey | the Guide

    i am a loser geek, crazy with an evil streak,
    yes i do believe there is a violent thing inside of me.

  • #12
    Supreme Master coder! glenngv's Avatar
    Join Date
    Jun 2002
    Location
    Philippines
    Posts
    11,075
    Thanks
    0
    Thanked 256 Times in 252 Posts
    When window.location is executed, the URL is changed in the address bar, thus the favelet is erased before other codes are executed.
    Glenn
    ____________________________________

    My Blog
    Tower of Hanoi Android app (FREE!)
    Tower of Hanoi Leaderboard
    Samegame Facebook App
    vBulletin Plugins
    ____________________________________

  • #13
    Senior Coder
    Join Date
    Aug 2002
    Location
    Kansas City, Kansas
    Posts
    1,518
    Thanks
    0
    Thanked 2 Times in 2 Posts
    Alright, thanks everyone.


  •  

    Posting Permissions

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