Load random iframe

Hi: I would like to know if anyone can help me with this
issue:
I'm developing a web site with an iframe in the center of its
main content with featured products.
I want the index.html, where the iframe it's included, to
change it every time the page reloads, loading random htmls from a
specified folder to display in the iframe area.
I don't know if I'm clear enough... perhaps my English is not
very good. I would appreciate any help. Thanks a lot.

javichampagne wrote:
> Hi: I would like to know if anyone can help me with this
issue:
>
> I'm developing a web site with an iframe in the center
of its main content
> with featured products.
>
> I want the index.html, where the iframe it's included,
to change it every time
> the page reloads, loading random htmls from a specified
folder to display in
> the iframe area.
>
> I don't know if I'm clear enough... perhaps my English
is not very good. I
> would appreciate any help. Thanks a lot.
>
Does your server support a server langauge like php?
If so insert the following piece of php code into the top of
your page.
1,14 being the number of files in your specified folder,
change it to
suit how many files there are ie (1,5) (1,8) (1,11) etc
<?php
// Set the lowest & highest numeric point in you series
names of your
includes files
$sl = rand(1,14);
?>
Then insert this in the table cell or <div> where you
need the random
file called in
<?php
include ('random_pages/file_'.$sl.'.php');
?>
'random_pages' being the folder name the files are in. Name
the files in
the folder file_1.php, file_2.php, file_3.php etc
Obviously you need php running on a server but you can use
other server
languages as well but youll have to google to find out some
code. I'm
sure it works similar.

Similar Messages

  • Flash content loaded in IFRAME gets disappeared while applying transform:scale css property

    I have an iframe loaded with a flash content inside, and i have to resize the iframe while browser window width changes. So i tried changing transform:scale() property on different media query cut-offs. But unfortunately firefox makes the flash content disappear while applying transform-scale property. Is there any way to overcome this?

    Sorry, i don't know how to visualize this. I can paste a sample code here, will it help?
    '''HTML:'''
    <iframe width="900px" class="iframeStyle" align="middle" height="1200px" frameborder="0" src="http://linktoFlashContainingHtml.html"> </iframe>
    '''CSS'''
    .iframeStyle {
    transform:scale(0.5);
    While applying this tranform:scale property, iframe get scaled but flash content inside the page loaded in IFRAME disappears

  • Load random swf but not same

    someone here helped with the code to load random SWF files
    into a movie clip...however, i need to make sure it doesnt load the
    one that's already playing, that it goes on to a new one
    everytime..

    i dont think saying thank you really does it, but really,
    thank you.. you've helped me countless number of times, and it's
    only made me better at what I do, so I really am great full .
    Thanks again

  • Load random flv

    This is my catch 22 ...
    Im trying to load random flv's into my mc. I cant seem to figure out how to loop random flv's.  Currently, it plays a random flv the 1st time, plays a random flv the 2nd time around, but the 3rd time (and so on) it loops the same 2nd flv.  I need it to constantly loop random flv's every time.  Any suggestions? 
    var randomNum:Number=Math.random();
    var connection:NetConnection = new NetConnection();
    var stream:NetStream;
    var video:Video=new Video(stage.stageWidth,stage.stageHeight);
    var metaObj:Object = new Object();
    var isPaused:Boolean=true;
    connection.connect(null);
    stream=new NetStream(connection);
    stream.client=metaObj;
    metaObj.onMetaData=onMetaData;
    function onMetaData(data:Object):void {
    video.attachNetStream(stream);
    mc.addChild(video);
    //load background video
    function videoInit():void {
         if (randomNum<=.333) {
              stream.play("clipA.flv");
         if (randomNum>.333&&randomNum<.666) {
              stream.play("clipB.flv");
         if (randomNum>=.666) {
              stream.play("clipC.flv");
    videoInit();
    function videoLoop(stat:Object):void {
         if (stat.info.code=="NetStream.Play.Stop") {
              if (randomNum<=.333) {
                   stream.play("clipA.flv");
              if (randomNum>.333&&randomNum<.666) {
                   stream.play("clipkB.flv");
              if (randomNum>=.666) {
                   stream.play("clipC.flv");
         stream.addEventListener(NetStatusEvent.NET_STATUS, videoLoop);
    Thanks in advance!

    First, you can shorten code and remove function videoLoop altogether. As for random issue, you need to reset random number to a new one - I don't see other issues with it. See code below:
    import flash.events.Event;
    var randomNum:Number;
    var connection:NetConnection = new NetConnection();
    var video:Video = new Video(stage.stageWidth, stage.stageHeight);
    var metaObj:Object = new Object();
    var isPaused:Boolean = true;
    connection.connect(null);
    var stream:NetStream = new NetStream(connection);
    stream.client = metaObj;
    metaObj.onMetaData=onMetaData;
    function onMetaData(data:Object):void {
    video.attachNetStream(stream);
    mc.addChild(video);
    videoLoop();
    function videoLoop(stat:Event = null):void {
         if (!stat || stat.info.code == "NetStream.Play.Stop") {
              randomNum = Math.random();
              if (randomNum <= .333) {
                   stream.play("clipA.flv");
              else if (randomNum > .333 && randomNum < .666) {
                   stream.play("clipkB.flv");
              else {
                   stream.play("clipC.flv");
        stream.addEventListener(NetStatusEvent.NET_STATUS, videoLoop);
    Also, you may want to reconsider how you reference videos and put the into an array and choose from it - this is more scalable:
    import flash.events.Event;
    var videoArray:Array = ["clipA.flv", "clipB.flv", "clipC.flv"];
    var connection:NetConnection = new NetConnection();
    var video:Video = new Video(stage.stageWidth, stage.stageHeight);
    var metaObj:Object = new Object();
    var isPaused:Boolean = true;
    connection.connect(null);
    var stream:NetStream = new NetStream(connection);
    stream.client = metaObj;
    metaObj.onMetaData=onMetaData;
    function onMetaData(data:Object):void {
    video.attachNetStream(stream);
    mc.addChild(video);
    videoLoop();
    function videoLoop(stat:Event = null):void {
         if (!stat || stat.info.code == "NetStream.Play.Stop") {
              stream.play(videoArray[Math.random() * videoArray.length]);
         stream.addEventListener(NetStatusEvent.NET_STATUS, videoLoop);

  • What is the best way to repeatedly load random commercials?

    Hi Everyone,
    Any help with the above question would be useful.  Here's my end goal: I want to display commercials on a screen at my wife's bakery.  The script should load one commercial, play it, then unload it, randomly load another, and so on.
    I am completely new to as3 and have unsuccessfully been following several online tutorials.  My first attempt had code in each commercial file (swf), that randomly called up another commercial, which in turn called up another file, and so on--but this became a memory hog and crashed the program after a few minutes.
    Since then I have created one main swf file that loads an xml file, which holds all the information for the commercials.  However, when the swf commercials are loaded according to the xml file, they don't play properly: when the first commercial finishes playing, the next one is already partially done.  Obviously it started playing earlier.  The swfs should unload and load the next according to a timer, with the length of the timer being different for each swf according to the xml data.  Even with this, the first swf didn't always stop when it should.  My code is getting complicated and the display looks sloppy.
    I think something like this should be a simple way to display media such as these commercials, but I still haven't found a working solution.  Now I'm wondering if I'm even approaching this wisely.
    Would it be better to convert the swf to flv and create an flv player that has 'continuous play' and 'shuffle' features?  Would it be better to convert each swf into movieclips and put them all into one swf?  (I like the manageability of using an external xml file; I will be adding and removing commercials frequently and want to keep this as simple as possible.)
    Please let me know what you think is the wisest approach and refer me to any relevant tutorials.
    Peace,
    Trevor

    Thanks again kglad,
    I followed your advice, but it is still not working properly.  Here's my problem:
    The external swfs continue playing in the background.  Consequently, the event "playcomplete" was dispatched not only at the end of the swf that is being shown, but also at the end of the looping, previously loaded swfs that are not visible; this made the next swf play before the one being shown finished.  That seemed easy enough to fix by adding stop(); to each external swf on the last frame.  I thought everything was fixed -- but those swfs must still be there and are hogging memory before they can be collected for garbage. I've developed a loop that continues to load swfs, taking more and more memory, eventually causing a crash.  So:
    After a swf is loaded, how do I completely remove it to free up memory?  I'll attach the code I'm using, but I've made some adjustments to your previous examples (using a string with a random number instead of an array, using different variable names, etc).  Would I still have this memory problem if I used an array?  I have tried to remove eventListeners, to use weak eventListeners, and to remove the loaded Child as best as I know how, but I need some guidance on memory management before I can use this.
    Peace,
    Trevor
    var swfLoader:Loader = new Loader();
    var klaesiSwfs:XMLList;
    var totalSwfs:Number;
    //var swfArray:Array = ["swfs/movie1.swf", "swfs/movie2.swf", "swfs/movie3.swf", "swfs/movie4.swf", "swfs/movie5.swf"];
    //loads xml//
    var klaesiXmlLoader:URLLoader = new URLLoader ();
    klaesiXmlLoader.load(new URLRequest("xml/swf_depot.xml"));
    klaesiXmlLoader.addEventListener(Event.COMPLETE, processXML, false, 0, true);
    //finds how many swfs are on xml//
    function processXML (e:Event):void{
         var klaesiXml:XML = new XML(e.target.data);
         klaesiSwfs=klaesiXml.ID;
         totalSwfs=klaesiSwfs.length();
         //trace ("Total is " + totalSwfs);
         loadRandomSwf();
         klaesiXmlLoader.removeEventListener(Event.COMPLETE, processXML)
         klaesiXmlLoader = null;
    //loads swfs//
    function loadRandomSwf():void {
         var num:Number = (Math.floor(Math.random() * totalSwfs) + 1);
         var swfName:String = "swfs/movie"+ num +".swf";
         var requestSwf:URLRequest = new URLRequest (swfName);
         swfLoader.load(requestSwf);
         addChild(swfLoader);
         swfLoader.contentLoaderInfo.addEventListener(Event.COMPLETE, playComplete, false, 0, true);
    //listens for the end of each swf//
    function playComplete(e:Event){
         MovieClip(swfLoader.content).addEventListener("playNextCommercial", nextSwf, false, 0, true);
         swfLoader.contentLoaderInfo.removeEventListener(Event.COMPLETE, playComplete)
    //removes old swf, starts new swf//
    function nextSwf(e:Event){
         MovieClip(swfLoader.content).removeEventListener(Event.COMPLETE, nextSwf);
         removeChild(swfLoader);
         loadRandomSwf();

  • Applet not rendered in IE8 loaded via iframe dynamically

    Hi,
    I have an applet that is loaded inside an iframe. The iframe is added to the document via javascript dynamically. When i add the iframe to the html page, the applet is not getting rendered in IE8. Working as expected in all other browsers.
    Interestingly, If i do any other action on the page like clicking on a check box after calling the javascript method that adds the iframe, the applet is being rendered .
    And if i add the iframe to the html statically, even in this case it works. Please help out with this.

    Hi,
    post questions about web site development to stackoverflow (IE forums). Include with your questions a link to your website or a mashup that shows the issue.
    go to java.com to update your Java RTE version and to remove outdated versions from your machines.
    web pages using the file protocol (file://) will not load external (http(s)) content.
    Tools>Internet Options>Security tab, click "Reset all zones to default". MSIE has security zone settings for scripted applets and unsigned controls.
    Start>Control Panel>Java JRT - Oracle Java JRT has security settings also.
    Regards.
    Questions regarding Internet Explorer 8, 9 and 10 and Internet Explorer 11 for the IT Pro Audience. Topics covered are: Installation, Deployment, Configuration, Security, Group Policy, Management questions. If you are a consumer looking for answers or to
    raise a question, it's highly recommended you head on over to http://answers.microsoft.com/en-us
    Rob^_^

  • Load random FLV with NetStream

    Dear Adobe members,
    I'm puzzeling for days on this one. I'm a bit of a noob so please help me
    I want to create a videowall in a grid of 7 x 7 flv's.
    In this grid, the flv's have to be loaded at random and when finished, a new
    random flv has to be loaded and played.
    I've come so far that I have a MovieClip that loads an flv at random and then
    loops it, but it loops the same video, not a random new one.
    Can anybody help me out please?!
    The code:
    var video:Video = new Video();
    addChild(video);
    var nc:NetConnection = new NetConnection();
    nc.connect(null);
    var ns:NetStream = new NetStream(nc);
    ns.client = {onMetaData:ns_onMetaData, NetStatusEvent:ns_onPlayStatus};
    var video_array = new Array("Scenes/001.flv", "Scenes/002.flv", "Scenes/003.flv", "Scenes/004.flv");
    // Function that gets a random video from the array
    function getRandomVideo():String {
    return video_array[Math.floor(Math.random() * video_array.length)];
    video.attachNetStream(ns);
    ns.play(getRandomVideo());
    function ns_onMetaData(item:Object):void {
    // Resize video instance.
    video.width = item.width;
    video.height = item.height;
    // Center video instance on Stage.
    video.x = (stage.stageWidth - video.width) / 2;
    video.y = (stage.stageHeight - video.height) / 2;
    //loop the video
    function ns_onPlayStatus(event:NetStatusEvent):void {
    if(event.info.code == "NetStream.Play.Stop"){
         ns.seek(0);
    ns.addEventListener(NetStatusEvent.NET_STATUS, ns_onPlayStatus);
    Thanks!

    For those who want to know how I solved it:
    var nc:NetConnection = new NetConnection();
    nc.connect(null);
    var ns:NetStream = new NetStream(nc);
    ns.bufferTime = 0;
    ns.addEventListener(AsyncErrorEvent.ASYNC_ERROR, asyncErrorHandler);
    var video_array = new Array("Scenes/001.flv", "Scenes/002.flv", "Scenes/003.flv", "Scenes/004.flv");
    // Function that gets a random video from the array
    function getRandomVideo():String {
    return video_array[Math.floor(Math.random() * video_array.length)];
    ns.play(getRandomVideo());
    var vid:Video = new Video(182,137);
    vid.attachNetStream(ns);
    addChild(vid);
    function asyncErrorHandler(event:AsyncErrorEvent):void{
    // ignore error
    // loop video
    ns.addEventListener(NetStatusEvent.NET_STATUS, ns_onPlayStatus)
    function ns_onPlayStatus(event:NetStatusEvent):void{
    if(event.info.code == "NetStream.Play.Stop"){
    ns.play(getRandomVideo());
    ns.seek(0);

  • How to use Javascript to load random pages?

    I wonder if anyone knows how to use Javascript to load a list
    of links stored in the text file.
    Every address will take a line, and the Javascript will
    randomly select one of the addresses to load.
    The user will click the button "random" and access the page
    randomly selected by the script.

    Addition note:
    I forgot to say this because my computer froze......(how
    lame)
    I got the code for random accessing the links.
    But now the problem is, is there anyway to parse a text file
    into the array in Javascript?

  • Load Random Image in Flash?

    I've googled it and searched this forum. No luck.
    Does anybody know how to load a random image in flash. Like
    on a welcome screen (i.e. the first thing that shows up in my
    timeline with a stop command on it)
    I tried this:
    http://www.kirupa.com/developer/mx/loadingrandombackground.htm
    but can't do this where you are supposed to paste the code in
    Actions: "Now, look at your timeline. Right click on a blank
    keyframe in the timeline and select Actions. Copy and paste the
    following code: "
    seems like i have to add something first like adding a
    behavior like "goto URL" or "stop" or "goto frame" if you know what
    i mean.
    what do i click on???????????????????? to add this code into
    Actions.
    Thanx.

    let say you have 20 images file in jpg format, all at the
    same directory with your flash file, with file name as below:
    pic1.jpg
    pic2.jpg
    pic20.jpg
    in your flash, select the frame which you wan to load a
    random image, type script below:
    num = Math.ceil(10*Math.random());
    filename = "pic" + num + ".jpg";
    _root.createEmptyMovieClip("pic_mc", 1);
    loadMovie(filename, "pic_mc");
    //good luck

  • Content doesnt load in iframe which loads otherwise from the browser, same content opens in iFrame in IE and Chrome

    I have links of Charts which I want to integrate in iFrames but they doesnt work while in iFrame. This used to work in older mozilla FF browser but started recently. I am using the latest which is 20.X. To test this I have opened the Chart link in Firefox Browser, it loads fine but while placed in a sample html file with just an iFrame, it fails. Same File loads the chart properly in iFrame in latest IE and Chrome browsers.

    Most CSS errors are caused by CSS rules for other browser like IE and can be ignored.<br />
    Only parsing errors like property names that start with a hash (#background, #display, etc.) are important and should be fixed.
    Are there any errors present if you hide the CSS errors and only check for Net errors?
    Can you open the iframes in a (new) tab?

  • Swf loader and iframe

    Hi all,
    I have been using iframes in my application and they are working fine. Now, my application's swf file is loaded into another flex application using swfloader and now iframes are giving error? can any body let me know what went wrong?
    thanks

    Im sorry how do you mean in  a "compltete" event handler,
    could you show me an example ?
    THanks

  • Load random swf into movie

    I need to load a randomly selected .swf into my main movie.
    Have found the code below which does all the loading fine...
    ... however, I need to keep elements from the original, so is
    there a way to load the new movie INTO the main one?
    I think I might need to load into an empty instance? If so,
    what does my code need to look like?
    Thanks in advance

    You should use the MovieClipLoader class.
    var mcl = new MovieClipLoader();
    var lis = new Object();
    lis.onLoadInit = function(target:MovieClip){
    //target is loaded and ready when this fires
    mcl.addListener(lis);
    function loadFile(fileURL){
    mcl.loadClip(fileURL, content);
    Now you can just call loadFile with a url and it will be
    loaded into the
    clip 'content', which can be an empty clip on stage. You
    don't have to do
    anything in the listener, but you can set width, height,
    alpha etc. in
    onLoadInit.
    HTH
    Dave -
    www.offroadfire.com
    Head Developer
    http://www.blurredistinction.com
    Adobe Community Expert
    http://www.adobe.com/communities/experts/

  • Firefox does not load random websites. Using a 3.6 or later version, with an XP OS.

    My Dad's laptop is using XP OS.
    He's been using Firefox quite a bit, until recently (about a month ago or more) when we go to any random website, it does not load. All it shows is a blank page and at the bottom bar it says "Done".
    But after refreshing it multiple times (and I mean A LOT of times) it either loads it or does not.

    A possible cause is security software (firewall) that blocks or restricts Firefox or the plugin-container process without informing you, possibly after detecting changes (update) to the Firefox program.
    Remove all rules for Firefox from the permissions list in the firewall and let your firewall ask again for permission to get full unrestricted access to internet for Firefox and the plugin-container process.
    See:
    * [[Server not found]]
    * [[Firewalls]]
    Make sure that you regularly check if there are updates available for your plugins.<br />
    See http://www.mozilla.com/plugincheck/
    Your above posted system details show outdated plugin(s) with known security and stability risks that you should update.
    # Shockwave Flash 10.1 r53
    # Next Generation Java Plug-in 1.6.0_14 for Mozilla browsers
    Update the [[Managing the Flash plugin|Flash]] plugin to the latest version.
    *http://www.adobe.com/software/flash/about/
    Update the [[Java]] plugin to the latest version.
    *http://www.oracle.com/technetwork/java/javase/downloads/index.html (Java Platform: Download JRE)

  • Firefox does not load the iframes until i refresh the page once i refresh the page it does work fine any idea y its so.....

    when i refresh the page all the details rellated to product is loading fine..the page contains two iframes with different src...the src for iframes is being provided from javascript

    Greasemonkey has a file which has metadata on your installed scripts. I remember looking at it once when there was a controversy about updates, but I don't know how to mine it for data.
    What happens if you exit Firefox and startup in your old profile and install GM 1.14 beta? Does that rescue your original setup?

  • Web pages will not load randomly.

    Certain websites that i go to will not load. trx250r.org or trx250r.net. Sometimes they will load. The website is not down though. I can access the websites on other computers hooked to my router via wifi and eithernet. I have had this issue since building a new computer. My old computer never had these issues, and still doesnt. So this random not loading a web page is isolated to this machine.
    Occasionally when i cannot access a site like trx250r.net i will try google chrome. Sometimes it will load the web page, other times it will not either. I am lost on what to do to correct this issue. I am certain it is a setting on my computer, but i have no idea what to check since it is random.

    You can reload web page(s) and bypass the cache to refresh possibly outdated or corrupted files.
    *Hold down the Shift key and left-click the Reload button
    *Press "Ctrl + F5" or press "Ctrl + Shift + R" (Windows,Linux)
    *Press "Command + Shift + R" (Mac)
    Start Firefox in <u>[[Safe Mode|Safe Mode]]</u> to check if one of the extensions (Firefox/Tools > Add-ons > Extensions) or if hardware acceleration is causing the problem.
    *Switch to the DEFAULT theme: Firefox/Tools > Add-ons > Appearance
    *Do NOT click the Reset button on the Safe Mode start window
    *https://support.mozilla.org/kb/Safe+Mode
    *https://support.mozilla.org/kb/Troubleshooting+extensions+and+themes
    Boot the computer in Windows Safe mode with network support (press F8 on the boot screen) as a test to see if that helps.
    *http://www.bleepingcomputer.com/tutorials/how-to-start-windows-in-safe-mode/

Maybe you are looking for

  • HT4650 Display freezes

    In the last few days, when I hit a key to start up the computer, all I will get is a blank screen with the small, multi-colored, rotating disk icon.  I can't get out of this unless I hold the power key down for about 5 seconds, which I know is probab

  • Power usage with external LCD monitor?

    Hi All, I'm wondering if using my MBP with an external screen would significantly reduce the laptop's battery endurance as my 5 months old MBP seems to have lowered its battery endurance to approx. 2.5 hours from the original state of 5 hours. in Sys

  • Can we add a pushbutton on the list ?

    Hi, I have to print a internal table and  a push button after the list. I can do it by SE41 but that can't be done at the end of the list. Is there any way to put pushbutton at the end of the list. or can we write a internal table contents on the sel

  • QM Material specification with inspection plan

    Hello, I'm trying to setup QM material spec with inspection plan and it doesn't work. I setup material master (With insp plant and with material spec). I Created a characteristic that I used in my inspection plan and maintained the characteristic in

  • Losing systemprofile after restarting the system

    Hi, I've been dying to know what's this is, and i don't really get it :  It happened 2 weeks ago, i "stopped" windows, and when i went to the office, the desktop vanished, no apps showing in the apps screen (don't know what it's called). And i got a