Monday, May 20, 2024
 Popular · Latest · Hot · Upcoming
192
rated 0 times [  194] [ 2]  / answers: 1 / hits: 19212  / 14 Years ago, tue, june 8, 2010, 12:00:00

I am looking to prevent the symbol & from being replaced by & within my URL, specifically within JavaScript.



Just to expand on this requirement, I am getting my url from an oracle database table, which I then use within Oracle Application Express, to set the src attribute of an iframe to this url.



FYI, the url stored in the Oracle table is actually stored correctly, i.e.



http://example.com/xml/getInfo?s=pvalue1&f=mydir/Summary.xml


What appears in my use when trying to pass over into iframe src using JavaScript is:



http://example.com/xml/getInfo?s=pvalue1&f=mydir/Summary.xml


which basically returns a page cannot be found


More From » html

 Answers
23

I suspect you are doing something like this:



1) Selecting the URL text from the database into an Apex page item.



2) In Javascript, getting the URL text from the page item and using it to set the iframe source.



When you select the value in step 1, Apex will automatically replace the & by & so that the page HTML is valid - it will be something like:



<input type=hidden id=P1_URL 
value=http://mydomain.com/xml/getInfo?s=pvalue1&amp;f=mydir/Summary.xml />


You will therefore have to reverse the transformation in your Javascript code - something like:



document.getElementById('myIframe').src = $v('P1_URL').replace('&amp;','&');

[#96562] Thursday, June 3, 2010, 14 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
cruzs

Total Points: 710
Total Questions: 113
Total Answers: 100

Location: Nepal
Member since Sat, Jul 18, 2020
4 Years ago
cruzs questions
Thu, Nov 26, 20, 00:00, 4 Years ago
Wed, Oct 28, 20, 00:00, 4 Years ago
Wed, Aug 19, 20, 00:00, 4 Years ago
Sun, Aug 2, 20, 00:00, 4 Years ago
;