aspose file tools*
The moose likes HTML, CSS and JavaScript and the fly likes Loading a jsp page in a popup loaded in another domain Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Java 8 in Action this week in the Java 8 forum!
JavaRanch » Java Forums » Engineering » HTML, CSS and JavaScript
Bookmark "Loading a jsp page in a popup loaded in another domain" Watch "Loading a jsp page in a popup loaded in another domain" New topic
Author

Loading a jsp page in a popup loaded in another domain

Rekha Pai
Ranch Hand

Joined: Oct 30, 2008
Posts: 35
Hi,

I am creating a jquery popup on an html page in say domain A.
I want to load a jsp page belonging to domain B. How can I do that.

I am giving below sample code I tried, but while running it gives
"xml can not be the whole program"

Can anybody help?

Regards,
Rekha.

Code I used :

<script src="./development-bundle/js/jquery-1.2.6.min.js" type="text/javascript"></script>
<link type="text/css" rel="stylesheet" media="all" href="./development-bundle/js/jquery.popup.css" />
<script src="./development-bundle/js/jquery.popup.js" type="text/javascript"></script>

$.ajax({
url: "http://A.com/apps/InfoMgmt/secure/index_new.jsp",
dataType: 'jsonp',
// data: 'xml',
success: true
});

$(document).ready(function(){
//define config object
var dialogOpts = {
modal: true,
bgiframe: true,
autoOpen: false,
height: 500,
width: 500,
draggable: true,
resizeable: true,
open: function() {

$.getJSON("http://A.com/apps/InfoMgmt/secure/index_new.jsp",
function(data){
$.each(data.items, function(i,item){
$("").attr("src", item.media.m).appendTo("#images");
if ( i == 3 ) return false;
});
});
$.get(
"http://www.google.com",
"{key:value}",
function(data) { alert(data); },
"html"
);
$.post("message.html", { func: "getNameAndTime" },
function(data){
alert("Hello");
}, "json");
// getUrl();
}
}


$("#example").dialog(dialogOpts); //end dialog
$("#example").dialog("open");

});
</script>
<script>

Eric Pascarello
author
Rancher

Joined: Nov 08, 2001
Posts: 15376
    
    6
Same origin policy means you can not get content from another domain. SO you can not fetch an html doc from another domain.

JSONP expects a JSON object wrapped in a function to be returned. Is that what is being returned?

When you post code, use code tags/

Eric
Rekha Pai
Ranch Hand

Joined: Oct 30, 2008
Posts: 35
Hi,

But the two domains belong to our intraweb.
Is there any way for me to pop up some alerts
depending on some data ( say passport expiry
alerts) in cross domain?

Regards,
Rekha.
Eric Pascarello
author
Rancher

Joined: Nov 08, 2001
Posts: 15376
    
    6
Rekha Pai wrote:Hi,

But the two domains belong to our intraweb.
Is there any way for me to pop up some alerts
depending on some data ( say passport expiry
alerts) in cross domain?

Regards,
Rekha.


No, browser has no clue they are both your sites. If you are using modern day browsers, you can look at CORS.

You should either use a proxy or an iframe.

Eric
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Loading a jsp page in a popup loaded in another domain
 
Similar Threads
Linking to so many jquery plugins
jquery accordion is causing jquery treeview picker to breakup
Directory Structure JSP & JS
Creating a masked popup in JavaScript
Is it possible to put a button inside autocomplete in jquery ui plugin?