Solved

pages loaded in iframe alter the main page history

Posted on 2003-12-10
4
436 Views
Last Modified: 2008-02-26
hello,
i have an iframe in which i load different sets of banners.... (html)
the banner page reloads itslef using a javascript settimeout function

its working perfectly, but what i noticed is that, when the user clicks on the back button, of the browser, or when he clicks the refresh button, actually its the iframe that get the command...(which will go back to the previous ad, or refresh the current one...)

how can i do this...

i am using an <iframe name="dany"></iframe>

then from a javascript inside the main page, i am changing the location of the iframe.

any suggestions?

thanks
Dan
0
Comment
Question by:Dany Balian
  • 2
  • 2
4 Comments
 
LVL 16

Expert Comment

by:jaysolomon
ID: 9915320
one way is to use a div instead of an iframe and use your JS function in the "main" page to set the innerHTML of the div, or change the image src.
0
 
LVL 11

Author Comment

by:Dany Balian
ID: 9915722
yeah man great idea...
but the problem is that with inner html i cannot load flash objects
i tried that, and i was able to rotate images, text, hyperlinks, tables, any html code except for a flash object!!
the banner.innerHTML="<object ...." does not work...

this is why i thought of iframe and that way i can change its source... which brings me to my problem...

thanks, any other suggestions?
Cheers, Dan
0
 
LVL 11

Author Comment

by:Dany Balian
ID: 9915754
just as a hint!!

when i check on the back history button (i can see a list of my ads turning...)

Advertisement
Advertisement
Advertisement
Advertisement
Advertisement
Advertisement

so a hint would be maybe to alter the history of the browser so that it doesnt load this frame's location into history... could that be done?
can we specify if we want to include the curent page's location in history or not?

Cheers, Dan
0
 
LVL 16

Accepted Solution

by:
jaysolomon earned 250 total points
ID: 9920818
This works for innerHTML

meaning i can set a object (flash) in a div's innerHTML

<html>
<head>
<title></title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<script type="text/javascript">
<!--
function setInnerHTML(obj){
      document.getElementById(obj).innerHTML = '<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=4,0,2,0" width="100" height="22">'+
                                                  '<param name=movie value="button1.swf">'+
                                                  '<param name=quality value=high>'+
                                                  '<param name="BASE" value=".">'+
                                                  '<param name="BGCOLOR" value="">'+
                                                  '<embed src="button1.swf" base="."  quality=high pluginspage="http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash" type="application/x-shockwave-flash" width="100" height="22" bgcolor="">'+
                                                  '</embed>'+
                                                '</object>';
}
// -->
</script>
</head>
<body>
<a href="#" onclick="setInnerHTML('myDiv');return false;">SS</a>
<div id="myDiv"></div>
</body>
</html>
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

This article shows how to create and access 2-dimensional arrays in JavaScript.  It includes a tutorial in case you are just trying to "get your head wrapped around" the concept and we'll also look at some useful tips for more advanced programmers. …
I've been trying to accomplish this for a while and it just struck me yesterday how to accomplish this task. I have done searches all over the internet looking for ways to email pages from my applications and finally I have done it!!! Every single s…
The viewer will learn the basics of jQuery, including how to invoke it on a web page. 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.: (CODE)
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…

914 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

17 Experts available now in Live!

Get 1:1 Help Now