Solved

Creating AJAX portlets in Oracle Portal

Posted on 2007-11-27
3
1,595 Views
Last Modified: 2013-12-18
I placed the following code inside an HTML portlet:

<html>
<head>
<script language="JavaScript" type="text/javascript">
var req

function loadURL(url)
{
req=null
if (window.XMLHttpRequest) {
req=new XMLHttpRequest()
}
else if (window.ActiveXObject) {
req=new ActiveXObject("Microsoft.XMLHTTP")
}
if (req!=null) {
req.onreadystatechange=state_Change
req.open("GET",url,true)
req.send(null)
}
else {
document.writeln("Cannot get URL status. Your browser does not support XMLHTTP.")
}
}

function state_Change(){
// if req shows "loaded"
if (req.readyState==4) {
// if OK
if (req.status==200) {
document.getElementById('A1').innerHTML="(Available)"
}
else {
document.getElementById('A1').innerHTML="(Connection Failure)"
}
}
}

</script>
</head>
<body onload="loadURL('http://www.yahoo.com')">

<p>
<b><a href="http://www.yahoo.com">Yahoo test</a> <span id="A1"></span></b>
</p>
</body>
</html>

It works fine offline, but once I put the code into an HTML portlet it doesn't work. I am not getting the security warning pop up so it doesn't look like the xmlhttp request object is being created.

Has anyone been able to get anything similar to work? If not, is there another way I can accomplish this in Portal?
0
Comment
Question by:shadowrox
  • 2
3 Comments
 
LVL 63

Expert Comment

by:Zvonko
ID: 20368653
Are you sure you get no access permission error or do you only not see the error?
In FireFox look for the error console by entering javascript: as url or by openning menu: Extras->ErrorConsole
In IE look in lover left window corner for the yellow triangle and click on it.

The acces is forbidden because you could fake yahoo.com if your script would be allowed, you see?

0
 

Author Comment

by:shadowrox
ID: 20370137
I ran the debugger. You're right, at  req.open("GET",url,true)  I get 'permission denied'.
0
 
LVL 63

Accepted Solution

by:
Zvonko earned 100 total points
ID: 20371788
So the answer to you question here is: what you want to do in browser is not possible when page is loaded from a web server because of security reasons. Do it on web server side scripting by PHP, ASP, Perl or what you have on web server side.

0

Featured Post

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Have you ever had to make fundamental changes to a table in Oracle, but haven't been able to get any downtime?  I'm talking things like: * Dropping columns * Shrinking allocated space * Removing chained blocks and restoring the PCTFREE * Re-or…
Upgrading Tomcat – There are a couple of methods to upgrade Tomcat is to use The Apache Installer is to download and unzip and run the services.bat remove|install Tomcat6 Because of the App that we are working with, we can only use Tomcat 6.…
This video shows information on the Oracle Data Dictionary, starting with the Oracle documentation, explaining the different types of Data Dictionary views available by group and permissions as well as giving examples on how to retrieve data from th…
This video shows how to recover a database from a user managed backup

810 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question