Solved

Creating AJAX portlets in Oracle Portal

Posted on 2007-11-27
3
1,590 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

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

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…
Checking the Alert Log in AWS RDS Oracle can be a pain through their user interface.  I made a script to download the Alert Log, look for errors, and email me the trace files.  In this article I'll describe what I did and share my script.
This video shows how to Export data from an Oracle database using the Original Export Utility.  The corresponding Import utility, which works the same way is referenced, but not demonstrated.
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…

757 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

Need Help in Real-Time?

Connect with top rated Experts

21 Experts available now in Live!

Get 1:1 Help Now