SitePoint Sponsor

User Tag List

Results 1 to 10 of 10
  1. #1
    SitePoint Enthusiast
    Join Date
    Aug 2010
    Posts
    51
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    My link to google doesn't work in IE

    hi all, i have this:

    window.location='http://google.com#q=testquery'

    works in opera / firefox / chrome / safari, but doesnt work in IE. does anyone have a fix or solution or hack around this problem?
    ps: the script is just to demonstrate my problem

  2. #2
    Unobtrusively zen silver trophybronze trophy
    paul_wilkins's Avatar
    Join Date
    Jan 2007
    Location
    Christchurch, New Zealand
    Posts
    14,527
    Mentioned
    84 Post(s)
    Tagged
    4 Thread(s)
    That works in Internet Explorer too. It will be some other issue that's causing your problem.

    We can help you get it working on Internet Explorer too, but we need to know more about what you're doing.

    A test web page that you can link us to will be most useful.
    Programming Group Advisor
    Reference: JavaScript, Quirksmode Validate: HTML Validation, JSLint
    Car is to Carpet as Java is to JavaScript

  3. #3
    SitePoint Enthusiast
    Join Date
    Aug 2010
    Posts
    51
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    my test site is at www.JuzCode.com

    it doesn't work in my IE. my ie takes http://google.com#q=testquer and translates it into http://google.com# which obviously is not what i want.

  4. #4
    SitePoint Guru team1504's Avatar
    Join Date
    May 2010
    Location
    Okemos, Michigan, USA
    Posts
    732
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    I do not see why that is happening... but I would be interested in finding out.

    Ill keep looking and thinking and let you know i I find anything, but pmw57 will porbably beat me to it.

    However, it works for me.
    Is the only problem that it is going to Google's home and not the query you want it to?

  5. #5
    SitePoint Enthusiast
    Join Date
    Aug 2010
    Posts
    51
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Yes basically IE ignores everything after the # symbol.. which is definitely not ok at least for my situation now,

    i don't mind a hack, i just need it to work

  6. #6
    SitePoint Guru team1504's Avatar
    Join Date
    May 2010
    Location
    Okemos, Michigan, USA
    Posts
    732
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    Quick idea, could it be that you need an escape character?
    I have to run but I dont think javascript requires one for the # sign, but trying /# wouldn't hurt would it.

    Hack-wise, I got nothing that is the only way I have ever known how to have a link open a search sorry.

    When I come back, Ill do some research and get back to you.

  7. #7
    SitePoint Enthusiast
    Join Date
    Aug 2010
    Posts
    51
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    well its nothing to do with javascript.. if i open the IE browser and type manually http://google.com#q=test it gives me only http://google.com whereas all the other browsers give me what i've typed, that is http://google.com#q=test

  8. #8
    Unobtrusively zen silver trophybronze trophy
    paul_wilkins's Avatar
    Join Date
    Jan 2007
    Location
    Christchurch, New Zealand
    Posts
    14,527
    Mentioned
    84 Post(s)
    Tagged
    4 Thread(s)
    When you visit google.com there is a permanently moved redirect (response code: 301 Moved Permanently) to www.google.com, during which for some strange reason Internet Exporer loses the fragment identifier.

    Try your luck on www.google.com instead of google.com, and let us know if you have any better results.
    Programming Group Advisor
    Reference: JavaScript, Quirksmode Validate: HTML Validation, JSLint
    Car is to Carpet as Java is to JavaScript

  9. #9
    SitePoint Guru
    Join Date
    Sep 2006
    Posts
    731
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by Pacerier View Post
    hi all, i have this:

    window.location='http://google.com#q=testquery'

    works in opera / firefox / chrome / safari, but doesnt work in IE. does anyone have a fix or solution or hack around this problem?
    ps: the script is just to demonstrate my problem
    I.E. sends exactly the same string but Google seems to have a reason to reject it for I.E. and also Opera.
    I got your code to work substituting /search?q= for /#?= . Is there any reason you can't use that format?
    Tab-indentation is a crime against humanity.

  10. #10
    SitePoint Enthusiast
    Join Date
    Aug 2010
    Posts
    51
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    heys cool, i wasn't aware of that link thx!


Bookmarks

Posting Permissions

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