Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

javascript location href changed queryString (&gt to >)

Tags:

javascript

I have the following code in my page.

   
 <script>
        var url = "http://localhost/login.aspx?returnUrl=/ABC/abc.aspx&gt_no=1234567&code=SC";
        window.location.href = url;
    </script>

when i load the page, it redirect to

http://localhost/login.aspx?returnUrl=/ABC/abc.aspx>_no=1234567&code=SC

the parameter &gt_no changed to >_no

Is there any method to keep &gt_no remain unchange after redirect?

It is not allow to use other parameter name insteand of &gt_no in my project.

The problem not just happen in localhost.

Thanks!

like image 367
SlateGray Avatar asked May 09 '26 14:05

SlateGray


1 Answers

You have arrived at a situation where you have generated an HTML encoded value value even though you didn't mean to :)

&gt is the HTML encoded value for the greater than character - >. You could try make sure that your gt_no parameter is the first parameter. This way, it will not be next to the ampersand (&) character and won't be interpreted as a HTML encoded value.

like image 94
Lix Avatar answered May 11 '26 04:05

Lix



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!