js/jquery - How to change existing iframe attribute from inside the iframe - javascript

I am working with TFS and I'm trying to upload an extension(web page) to the dashboard.
When the dashboard loads my extension it wrapps my it with Iframe.
TFS Iframe example
The iframe sandbox attribute missing the allow-same-origin which allow me to manipulate the page that contains my extension.
Is there a way to change the iframe attribute from my extension web page?
the whole page looks like:
<html> // Tfs page
<body>
<div> // main page
<iframe sandbox='allow-scripts ...'> // the iframe that wrapps my extension, missing 'allow-same-origin'
<html> // my extension
<body>
...
</body>
</html>
</iframe>
</body>
</html>
Thanks...

I think this is on purpose: you should use the SDK to interact with VSTS/TFS, otherwise it is easy to imagine a rogue Extension that sells a company's Intellectual Property in the deep web.

Related

using Javascript to locate an element in an Embedded web page which also in an embedded web page

I want to write a script to watch online courses automatically using Javascript. But when I want to locate an element in the html page,I find it was in an embedded web page which also in an embedded web page. I have been searching questions in Google and Baidu but I only find the way how to locate an element in an embedded web page. I also ask programmers around me but they also have no idea,oops. the following picture is the position of it("span" is the target).
<html>
<body>
<div class="main">
<iframe id="iframe" src="blala" allowfullscreen="ture" onload="clickImg()">
<html>
<body>
<div class="ans-job-icon">
<iframe src="video/blala" allowfullscreen="ture">
<html>
<body>
<span aria-hidden="true" class="vjs-icon-placeholder"></span>
</body>
</html>
</iframe>
</body>
</html>
</iframe>
</body>
</html>
Can you do me a favor? thx a lot.
Thank for all of your idea. With your advice, I finally work out this question with my friends. The solution is as
followed.
We find that “window" is one of the object in JavaScript, which can operate the element in "iframe". So you can use it to locate the tag in an embedded web page.
top
"top" is an attribute in the object window. By using the statement "window.top", you can get the top window in the web page. and then
Using the statement"window.top.iframe" to get the iframe object .
get the next iframe tag by object "document"
attribute "contentDocument" in iframe can be used to return the current document object. and then you can find the next iframe using the statement"window.top.iframe.contentDocument.getElementsByTagName('iframe')[0]"!

How can I force swf files to be run, not downloaded

For example, I want to make an iframe to this url: http://example.com/game.swf
The problem is, users who are on different browsers/devices/settings have the issue where instead of running the swf, the browser is just downloading it.
Keep in mind, I don't have access to the code for http://example.com, or the fla file. I need to use the iframe hack because of some issues with the swf.
The iframe must load an HTML file, instead of directly loading some SWF file. So get around that rule by embedding SWF within the same html that the iFrame will be loading.
If iframe has code:
<iframe src="http://example.com/game.html"> </iframe>
Then in game.html have code:
<!DOCTYPE html>
<html>
<body>
<embed src="http://example.com/game.swf" width="800" height="600">
</body>
</html>

PowerPoint presentation in web Browser without using Google Docs

I trying to display my ppt for long time where the screen should run continuously in web page without using Google Docs or Skype Drive where the ppt file and html page is in my local folder but it is not showing in web page. The code is below :
<!DOCTYPE html>
<html>
<body>
<iframe src="lp.ppt" width="800px" heigt="600px" name="iframe_a"></iframe>
</body>
</html>
can anyone help to display ppt in html page.
I'd recommend the official View Office documents online
For embedding you can simply use code like below:
<iframe src='https://view.officeapps.live.com/op/embed.aspx?src={urlencode(site-to-ppt)}' width='962px' height='565px' frameborder='0'></iframe>

XUL iframe firefox addon, how to change the src within the iframe?

I am developing a firefox addon,
in my settings page dialog.xul i have an iframe where i load different settings pages page1.xul page2.xul page3.xul
Iframe :
<vbox flex="1">
<iframe
id="iframe"
src="chrome://xxx/content/page1.xul"
flex="1"></iframe>
</vbox>
Within the iframe i need to navigate from page2.xul to page3.xul
with the code in page2.xul
My code (page2.xul) :
gBrowser.loadURI("chrome://xxx/content/page3.xul");
Also tried
document.getElementById("iframe").setAttribute("src", "chrome://xxx/content/page3.xul");
but it's not working i know iframe container is not accessible from the iframe but how can i do that redirection ?
With iframe in XUL you must create it with the HTML namespace otherwise things like load events don't work right, see this topic: http://forums.mozillazine.org/viewtopic.php?f=19&t=2809781&hilit=+iframe
Once you do that, changing src etc should work as expected.
Solution :
I managed to handle the code in the main XUL
Apparently XUL does not support the structure
[XUL1 >> iframe(XUL2 : change something in XUL1)]
This structure is not supported in classic HTML + Javascript for security reason
and it's also the case in XUL

iframe accessing child JavaScript of source

I have been trying to access a html source file through iframe. It works fine and I can see the source, but my external JavaScript file doesn't work through the iframe.
So far this is what I have for accessing the HTML file.
<iframe src="Example.html">
<p>Your browser does not support iframes.</p>
</iframe>
and then in Example.html I have:
<script src="SpinScript.js"></script>
This works if I run the HTML file in any browser, but not through the iframe
In this HTML file I have other JavaScript elements but they are just written in this document and they work fine through the iframe.
What I'm wondering is if have to re-establish where the JavaScript file is in the iframe?
Hope that all makes sense and thanks for your time.
Your parent window and iframe should be from the same source (url),
then you can use
window.frames[framename] to get window object in iframe

Categories