Activity Forums Salesforce® Discussions Window.location.href is not working in Microsoft edge

  • Adarsh

    Member
    February 20, 2018 at 5:45 am

    Hello Ajay,

    According to your post, my understanding is that the window.location.href not worked in IE 8 also.

    I think the issue is likely due to the value of your variables. If they contain special or invalid characters, those needs to be passed through 'encodeURIComponent' before being assigned to window.location.href.

    Ex.

    // encodes characters such as ?,=,/,&,:
    console.log(encodeURIComponent('?x=шеллы'));
    // expected output: "%3Fx%3D%D1%88%D0%B5%D0%BB%D0%BB%D1%8B"

    console.log(encodeURIComponent('?x=test'));
    // expected output: "%3Fx%3Dtest"

    You can also use the following methods to check whether it works.

    Window.navigate();

    Winodw.history.back();

    Self.location.href;

    Top.location;

    hope it helps 🙂

  • Parul

    Member
    September 20, 2018 at 10:04 am

    Hi,

    The problem is likely due to the value of your variables. If they contain special or invalid characters, those needs to be passed through encodeURIComponent before being assigned to window.location.href.

    Note -: The encodeURIComponent() function encodes a Uniform Resource Identifier (URI) component by replacing each instance of certain characters by one, two, three, or four escape sequences representing the UTF-8 encoding of the character (will only be four escape sequences for characters composed of two "surrogate" characters).

Log In to reply.

Popular Salesforce Blogs

Popular Salesforce Videos