cancel
Showing results for 
Search instead for 
Did you mean: 

Javascript not working in Internet Explorer

Former Member
0 Kudos

Hi,

I wrote a javascript function to redirect sites in my bsb application:

function gotoUrl(url)
{
    var destination=eval(window.parent);
    destination.location=url;
}

In my view I call the function like this:

  <xhtmlb:toolbarItem>
    <xhtmlb:toolbarButton id            = "b_create"
                          text          = "anlegen"
                          onClientClick = "gotoUrl('createnorm.do');"
                          groupId       = "s_c_s_m"
                          down          = "<%= b_create %>" />
  </xhtmlb:toolbarItem>

The javascript function "alert('Hello World'); does work in the IE and in my firefox the redirect is working as well but I can not find the problem with the IE.

If you have an idea, please let me know ^^.

mfg

Stefan

Accepted Solutions (0)

Answers (4)

Answers (4)

daniel_humberg
Contributor
0 Kudos

I would try the following


function gotoUrl(url)
{
    parent.location.<b>href</b>=url;
}

If you are not sure if the script will be called in a sub-frame or not, you can also use


function gotoUrl(url)
{
    top.location.<b>href</b>=url;
}

eddy_declercq
Active Contributor
0 Kudos

Stefan,

Does there appears a yellow sign with an exclamation mark appear in the left under corner of MIE. If so, double click on it. What does it say?

Can you btw confirm that you are working with frames? If you aren't working with frames, it should be

window.location = url;

Did you already try to specify the whole URL (with server + path, etc.)?

Als have a look at this:

http://www.winguides.com/registry/display.php/504/

Eddy

Former Member
0 Kudos

Moin,

I tried all your gotoURL functions but everytime it is the same, it works fine with the firefox but not with the IE( SP1 ).

I don't work with frames and even if I specify the whole URL.

So I start using the alert debugger ^^:

function gotoUrl(url)
{
    alert(window.location);
    alert(url);
    window.location = url;
    alert(window.location);
}

At the last alert the correct URL is shown in the status bar of the IE, but there is no redirection . And the alert post the wrong one !

Could it be a problem using xhtmlb ? It's the first time I use it an not the phtmlb or htmlb...

mfg,

Stefan

Message was edited by: Stefan Huemer

eddy_declercq
Active Contributor
0 Kudos

Hi,

The only way to find out is the create a BSP page with nothing more than.

...

function gotoUrl(url)

{

window.location = url;

}

...

<body onload="gotoURL('sdn.sap.com')">

...

I would also try to upgrade MIE. Eventually, you can try things out on a machine with the latest MIE.

Eddy

Former Member
0 Kudos

Hi,

I just did another simple test again ^^, @Eddy the redirect onLoad works fine. I used a htmlb:button instead of the xhtmlb:toolbarButton and

surprise surprise

it works fine in the IE and in my firefox.

So I think, there must be a problem with the xhtmlb.

As workaround I can use the htmlb buttons, but then the users can't see where they are by looking at the buttons....

edit:

they can see it, because I use the site attribute <%= down %> from the xhtmlb button group for my htmlb buttons.

Now the user sees the buttons not down, but disabled

mfg and thanks for help!

Stefan

Message was edited by: Stefan Huemer

Message was edited by: Stefan Huemer

Former Member
0 Kudos

@Raja

no there is no script error in the IE status bar

@Eddy

your function is working in my firefox, but also not in the IE

in both this code will be generate:

onclick="htmlbEF('parent.location='createnorm.do';');return htmlbEventCO(this,'click','xhtmlb:toolbarButton:click:null','search','siteheader_b_create','',0);" 

eddy_declercq
Active Contributor
0 Kudos

Hi,

I guess that you are working with frames, deducting from the fact that you're refering to the parent. The code can be a lot simplier:

function gotoUrl(url)

{

parent.location=url;

}

Eddy

athavanraja
Active Contributor
0 Kudos

do you see any script error (status bar) in IE?

Regards

Raja