I am trying to make html page that contain ads that prompt messages and dialoges like image below that makes redirects and loss original page and loss users
Example of dialoge
I want to stop any prompts or any dialoges on this page
My code is very simple html page with iframe
<iframe src="https://go.pub2srv.com/afu.php?id=1326365" height="500" width="900"></iframe>
Thanks
You could prevent the iframe from running Javascript by adding a sandbox attribute to the <iframe> element. Here's how it may look:
<iframe src="https://go.pub2srv.com/afu.php?id=1326365" height="500" width="900" sandbox=""></iframe>
You could refer to this page to understand how that works: https://www.w3schools.com/tags/att_iframe_sandbox.asp
Of course, this is the perfect solution because the iframe might require some privileges, in such case you could add specific privileges that the particular ad requires.
Related
I'm trying to embed https://ncase.me/remember/sims/ebbinghaus/?mode=0 onto a page using an iframe. However, when I do, it does not display any of the interactive elements. See https://codepen.io/UYasher/pen/yLXaPeo for the behavior in an iframe:
<iframe
style="width: 600px; height:370px;"
will_source="https://ncase.me/remember/sims/ebbinghaus/?mode=0"
scrolling="no"
class="simulation"
src="https://ncase.me/remember/sims/ebbinghaus/?mode=0"
>
</iframe>
How can I fix this issue so that the iframe shows all the elements present on the original page?
What I think is causing the issue:
I think this occurs because the iframe is unable to load the scripts at the bottom of ncase.me page. I don't understand why this is, though, as javascript appears to work in some iframes. For example, in order for google maps to run, scripts in the contents of the iframe need to be loaded and run.
I have a portfolio page that embeds around 12 iframe elements. I am wondering if there is a way to cache or autoload the iframe elements so that I do not need to reload every time the website loads.
Here are what my iframe elements look like:
<iframe src="http://iframe.url" width="300" height="600" frameborder="0"></iframe>
The iframe element houses banner advertisements, consisting of images, HTML, and JS code. Please let me know how to accomplish this task. Thank you for your help!
I'm quoting the information here. If I understand what you are wanting, this looked promising.
Friendly Iframe
This technique is for ads. It's not really an iframe loading
technique, but more of a way to use an iframe to hold ads. The magic
is not in how the iframe is loaded, but in how the main page, the
iframe and ad codes work together. It works like this:
Create an iframe. Set the source to a small static html page from the same domain
Inside the iframe, set the JavaScript variable inDapIF = true to tell the ad it is loaded inside a friendly iframe
Inside the iframe, create an script element with the ad url as the source. Load the ad just like a normal JavaScript ad
When the ad has finished loading, resize the iframe to fit the dimensions of the ad.
The Friendly Iframe works in all browsers.
There were other techniques listed, but this seem to fit your use case. See the other methods at Iframe loading techniques and performance
If you are wanting a method to force the iFrame to reload, here is an SO answer on that. How to force an iFrame to reload once it loads
You can set html meta tag for url in iframe.
<META HTTP-EQUIV="EXPIRES"
CONTENT="Mon, 22 Jul 2018 11:12:01 GMT">
This will cache the results of iframe.
Even you can use AJAX to load the contents. This will not reload the entire page, instead i will change contents dynamically. Cache AJAX results to save bandwidth.
I'm fairly new to html so basically I have an Iframe and I want it to auto click a specific location when a user enters a website. I want it physically click the google search button Is it possible to give a location for a click? If so it would be helpful to display some code. This is what i got so far.
<html>
<iframe src="http://www.google.com" width="700" height="500" frameborder="1">
<p>Your browser does not support iframes.</p>
</iframe>
</html>
Assuming you can load www.google.com into an iframe, you might try adding a query string onto the end of the URL.
Something like https://www.google.com/#q=my+search+criteria
The user doesn't click anything, but search results are loaded (assuming Google will let you load its website in an iframe).
Folks,
We have one strange requirement where we want to disable double click inside the IFRAME.
The complication here is HTML response is coming from remote URL and we donot have any control over it. Is it possible to disable double click inside this IFRAME.
e.g.
Iframe src="http://removeserver/view.jsp" height="300px" width="300px">
Note : We already investigated and it seems because of cross side scripting we cannot do this.Basically we cannot access HTML elements of page remoteserver/view.jsp as it is coming from remote web site.
Any help will be highly appreciated.
Empty div above iframe will disable any mouse actions on iframe content
http://jsfiddle.net/uxUF8/63/
<iframe with="300" height="300" src="https://www.youtube.com/embed/OsOYg5gpS0s" ></iframe>
<div style="position:absolute;margin-top:-300px;width:300px;height:300px;border:1px solid red;" ></div>
another version allows you to scroll inside http://jsfiddle.net/uxUF8/62/
I want to allow any page to be loaded inside an iframe. It's for teaching purposes so I want to know if it's possible to force let's say:
<iframe src="http://www.wolframalpha.com/input/?i=5*sin%28x%29" width="400" height="100">
to stay inside the iframe. By default it has some kind of javascript that opens in full page.
UPDATE: What if i use frames? (please don't throw bricks at me) Could they know if the page is inside a frame?
If the page itself wants to break out of being framed with it's own javascript (which apparently this page is doing), it can do so and I know of no way to prevent it other than turning javascript off in your own browser which obviously isn't an option for general viewing.
On some browsers, you can set an attribute on the iframe element that sets a security policy that prevents the iframe from executing JavaScript. I don't remember the attribute name and not sure which browsers support it (I'm sure ie does, not quite sure about the others). If you have problem finding more details, I'll look it up when I get home (on a mobile right now)
edit: found it - security="restricted". Seems to be IE-only.
If you have links outside of this iFrame and want them to load into that iFrame on the same page, you'll have to give it a name, then target the named iFrame within your link's href.
<iframe src="http://google.com" name="myframe" hieght="100" width="100"></iframe>
<br />
Derp.
However, if you're loading a page into your iFrame that's loading links with target="blank", then those will go to a new window; unless you don't have access to those pages, you won't be able to change the links (short of writing JS to dive into your iFrame, etc).