The Web Design Group

... Making the Web accessible to all.

Welcome Guest ( Log In | Register )

 
Reply to this topicStart new topic
> Write a dynamic iframe
RainLover
post Nov 11 2011, 01:48 PM
Post #1


Advanced Member
****

Group: Members
Posts: 191
Joined: 16-November 09
Member No.: 10,346



Hi,

I wonder if the following is coded correctly:

CODE
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title>Sample Page</title>
</head>
<body>
<div id="container"></div>
<script type="text/javascript">
var url = "http://www.example.com/";
var content = "<iframe width='800' height='600' frameborder='0' src='" + url + "'><\/iframe>";
document.getElementById("container").innerHTML = content;
</script>
</body>
</html>


Many thanks in advance!
Mike


--------------------
User is offlinePM
Go to the top of the page
Toggle Multi-post QuotingQuote Post
Christian J
post Nov 11 2011, 03:03 PM
Post #2


.
********

Group: WDG Moderators
Posts: 5,985
Joined: 10-August 06
Member No.: 7



Seems correct, but of course it will only work if inline frames and javascript are enabled/supported. At least some search engine's (Google) claim to be able to find the framed page's URL in the script as well, in which case they might link directly to the orphaned page.


--------------------
User is offlinePM
Go to the top of the page
Toggle Multi-post QuotingQuote Post

Reply to this topicStart new topic
1 User(s) are reading this topic (1 Guests and 0 Anonymous Users)
0 Members:

 



- Lo-Fi Version Time is now: 23rd August 2014 - 12:31 AM