How would i take a sub id from a destination url and have it dynamically inserted into an iframe code before the page or iframe is loaded?
I want to add the subid to be able to track conversions from adsense without having a thankyou/goal page since the iframe stays on the same page.
this is the code i have at the end of my destination url
&subid=campaignname_{keyword}
this is the iframe code where i want the subid to dynamically insert before loading
<iframe border="0" frameborder="0" width="680" height="800" src="http://xxxxxxx.com?PublisherSubID=</iframe>
If I understand correctly, you have a page http://xxxxxx.com?subid=12345 and you want to take the subid and drop it into the url of your iframe source.
Try this:
<iframe border="0" frameborder="0" width="680" height="800" src="<iframe border="0" frameborder="0" width="680" height="800" src="http://xxxxxxx.com?PublisherSubID=<?php echo $_GET['subid']; ?>"></iframe>
This will take the subid from the $_GET array of your page and drop it into the source url of your iframe.
This will also include the "campaignname_" text as well. if you want to strip that out, then instead of $_GET['subid'] use str_replace("campaignname_","",$_GET['subid']);
Related
I am displaying some 3rd party banners inside an Iframe which are loading through javascript. Banners are showing inside iframe and links are openning to new window when I browse the url myself. Problem is when I am trying to advertise the url to different ptc sites. Basically this site show url inside iframe. so when my url which is itself an iframe loading inside another iframe, clicking not working. Below is my current code
<base target="_blank"> //in head section
<iframe sandbox="allow-same-origin allow-scripts allow-forms allow-popups allow-downloads" src="<?php echo $_SESSION['ad_url'];?>" frameborder="0" id="pgl" name="pgl" style="overflow:hidden;height:100%;width:100%" height="100%" width="100%" onmouseover="on_mouseover(this)" onmouseout="on_mouseout(this)"></iframe>
As i see the source of the page that embeds my iframe found below code
<iframe sandbox="allow-same-origin allow-scripts allow-forms" id="surfsite" name="surfsite" src="https://sitename.com/sitename.php?" width="100%" height="100%" frameborder="0" scrolling="yes"></iframe>
how can I make this working
If I wanted to auto-click a button element in ifarme how would I go about this working ?
function autoclick() {
document.getElementById('u_0_4').contentWindow.document.getElementById("u_0_5").click()
}
<div onload="autoclick()" >
<iframe src="https://www.facebook.com/plugins/like.php?href=https%3A%2F%2Fweb.facebook.com%2FMaherZain&width=450&layout=standard&action=like&size=small&show_faces=true&share=true&height=80&appId=788255487990117" width="450" height="80" style="border:none;overflow:hidden" scrolling="no" frameborder="0" allowTransparency="true" id="u_0_4" ></iframe>
</div>
=====> if have any other way for do that please tell me :(
You cannot do that because otherwise people would just embed a 1x1 iframe and have every visitor "Like" whatever the author wanted. It's a security issue to let different origins have access to the contentWindow of iframes pointing to a different origin.
Imagine if you were able to do that. People could just start embedding gmail or your banking website in a 1x1 iframe and then trigger a few clicks and keyboard events to reset your password.
I want to use Google vrview-web using this example: googlevrview
How can I set src attribute in iframe tag?
Below is the example given in the link:
<iframe width="100%" scrolling="yes" allowfullscreen src="https://storage.googleapis.com/vrview/examples/video/index.html?video=examples/video/congo_2048.mp4&is_stereo=true"></iframe>
Now I have to set my video URL in src like below:
<iframe width="100%" scrolling="yes" allowfullscreen src="<?php echo VIDEO_URL.$data["video"]; ?>&is_stereo=true"></iframe>
It does not display the video.
if I use below iframe tag:
<iframe width="100%" scrolling="yes" allowfullscreen src="https://storage.googleapis.com/vrview/examples/video/index.html?video=MY_VIDEO&is_stereo=true"></iframe>
Still, it prints this data in my page:
Output
Assuming that the VIDEO_URL hold this:
https://storage.googleapis.com/vrview/examples/video/index.html?video=
Your iframe can't just print the HTML. Please inspect your rendered HTML/DOM or iframe src value is proper and not broken.
Moreover it is required that your website, where the videos are, allows CORS. Cross origin resource sharing. Otherwise the Google's script won't load your video inside the iframe in VR mode.
I have been trying ot hunt this down all afternoon, Im pretty new to all this and am building my first site with php
what Im trying to do is I have a google maps embed code stored in a Db which I have assigned to a variable $map, I want to inject the embed code into an existing div.
So basically a click here for map. I may be way off on what I can do here.
Im sure there is a fancier way to do this but Im just learning and trying something simple.
Sorry if this is something that is obvious.
I have no code to show as i have murdered it and it is an unhelpful mess now.
If the page has already been served to the user, you'll need to use javascript to update the div, or reload the page. I jQuery's .post method to dynamically refresh divs with using AJAX. Info at http://api.jquery.com/jQuery.post/.
I use the following code on my website, which sounds similar to what you're trying to do, but in my case, I'm passing the address to the embed code in the $addresssubjectfullgoogle variable:
<iframe width="100%"
height="350"
frameborder="1"
scrolling="no"
marginheight="0"
marginwidth="0" src="
https://maps.google.com/?f=q&t=h&ie=UTF8&output=embed&q=<?php echo $addresssubjectfullgoogle;?>&z=18&ll=<?php echo $addresssubjectfullgoogle;?>&ie=UTF8">
</iframe>
I suspect that you could do something similar except that in your case, the same could might look something like this:
<iframe width="100%"
height="350"
frameborder="1"
scrolling="no"
marginheight="0"
marginwidth="0" src="<?php echo $map;?>">
</iframe>
I hope that's helpful.
I have a form for updating my database. The form contains an embed-video-section which calls the embed code on a separate page to display the video in the page.
The problem is that embed links uses <iframes> which would be removed by my striptags.
I need some help in safely inserting the embed code from my form to my database.
The embed codes look like this
<iframe width="420" height="315" src="http://www.youtube.com/embed/Ahg6qcgoay4" frameborder="0" allowfullscreen></iframe>
or <iframe src="http://blip.tv/play/hIVVgfKwRgI.html" width="550" height="339" frameborder="0" allowfullscreen></iframe>
You could try to use BBCodes. For example, [embed param1=value param2=value] and so on..