Solved

pages loaded in iframe alter the main page history

Posted on 2003-12-10
4
440 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
[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
  • 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

[Webinar] Code, Load, and Grow

Managing multiple websites, servers, applications, and security on a daily basis? Join us for a webinar on May 25th to learn how to simplify administration and management of virtual hosts for IT admins, create a secure environment, and deploy code more effectively and frequently.

Question has a verified solution.

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

Suggested Solutions

This article discusses the difference between strict equality operator and equality operator in JavaScript. The Need: Because JavaScript performs an implicit type conversion when performing comparisons, we have to take this into account when wri…
JavaScript can be used in a browser to change parts of a webpage dynamically. It begins with the following pattern: If condition W is true, do thing X to target Y after event Z. Below are some tips and tricks to help you get started with JavaScript …
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…
Suggested Courses

737 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