Forum Moderators: open
I tried a SSI-include from which I found out that it's not working for external urls.
Now I have this snippet of javascript:
<script type="text/javascript" src="http://www.example.com/page2.html"> </script>
the code looks fine to me,but I'm not getting any output visible on my page with that code.
Using iframes is not possible because the content wouldn't really be inserted into my page.
I hope someone can help me with this.
HTML here
HTML here
<script type="text/javascript" src="http://www.example.com/page2.js"> </script>
HTML here
HTML here
page2.js
=================
document.write("here goes your second page text");
You could also perform document.write for text retrieved by HTTPRequest
xmlhttp=null;
// for Mozilla
if (window.XMLHttpRequest) {
re = new XMLHttpRequest();
}
// for IE
else if (window.ActiveXObject) {
re = new ActiveXObject("Microsoft.XMLHTTP");
}
if (re!= null) {
re.onreadystatechange=stateChange;
re.open("GET","http://www.yourSire.tld/page2.html",true);
re.send(null);
}
function stateChange() {
if (re.readyState==4) {
if (re.status==200) {
document.write(re.responseText);
}
}
}
page1.html
=================
HTML here
HTML here
<div id="page2div"></div>
<script type="text/javascript">
re=null;
// for Mozilla
if (window.XMLHttpRequest) {
re = new XMLHttpRequest();
}
// for IE
else if (window.ActiveXObject) {
re = new ActiveXObject("Microsoft.XMLHTTP");
}
if (re!= null) {
re.onreadystatechange=stateChange;
re.open("GET","http://www.yourSire.tld/page2.html",true);
re.send(null);
}
function stateChange() {
if (re.readyState==4) {
if (re.status==200) {
document.getElementById("page2div").innerHTML = re.responseText;
}
}
}
</script>
You could also perform document.write for text retrieved by HTTPRequest
As long as the source is from the same server as that serving the page. Otherwise, this won't work as well as the PHP include URI. Same goes for SSI.
I believe that the goal is external URIs. Even ASP ain't so good at resolving external URIs. Only PHP seems to have this ability, and then, only when that functionality [us3.php.net] has been enabled (default).
Now, I have to ask, is this an ISP that isn't providing this support? I think that it is so dirt easy to get an ISP to give this support that you may want to take moving to a more active-server-content-friendly ISPinto consideration.
I use PHP include to serve active content to clients, but you have to carefully craft the page to be included, unless the PHP include is the ONLY text on the page. This is because you can't have a "page within a page."