Solved

Creating AJAX portlets in Oracle Portal

Posted on 2007-11-27
3
1,600 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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

Enroll in June's Course of the Month

June’s Course of the Month is now available! Experts Exchange’s Premium Members, Team Accounts, and Qualified Experts have access to a complimentary course each month as part of their membership—an extra way to sharpen your skills and increase training.

Question has a verified solution.

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

This post first appeared at Oracleinaction  (http://oracleinaction.com/undo-and-redo-in-oracle/)by Anju Garg (Myself). I  will demonstrate that undo for DML’s is stored both in undo tablespace and online redo logs. Then, we will analyze the reaso…
International Data Corporation (IDC) prognosticates that before the current the year gets over disbursing on IT framework products to be sent in cloud environs will be $37.1B.
Video by: Steve
Using examples as well as descriptions, step through each of the common simple join types, explaining differences in syntax, differences in expected outputs and showing how the queries run along with the actual outputs based upon a simple set of dem…
Via a live example, show how to restore a database from backup after a simulated disk failure using RMAN.

717 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