Load external text in HTML - html

I want to load a static text file from an HTML document without using Javascript or any server side language.
I've tried using object tag as follows:
<object id="information" name="information" data="http://www.example.com/data.txt"></object>
But it didn't work. Is it possible to do this? If so, which tag should I use?

You should use an <iframe src="..." />.

Related

TYPO3 DCE (Fluid): How to generate an SVG Object instead of an image tag?

Our TYPO3 users (editors) need to exchange / update SVG files to the TYPO3 website. The svg files are clickable, hence the <img> html tag does not work for them. We decided in favour of the <object> tag, with <img> fallback (Do I use <img>, <object>, or <embed> for SVG files?).
The Fluid code for the fronted is easy for generating normal img tags:
<f:layout name="Default" />
<f:section name="main">
<div class="container">
<f:for each="{dce:fal(field:'image1', contentObject:contentObject)}" as="fileReference" iteration="iterator">
<f:if condition="{iterator.isFirst}">
<f:image src="{fileReference.uid}" alt="" treatIdAsReference="1" />
</f:if>
</f:for>
</div>
</f:section>
However, according to FluidTYPO3 vhs ViewHelper for SVG Images?, I might be able to use fluid code like this:
<img src="{f:uri.image(src: 'uploads/tx_myext/{imgIcon}')}">
which, adapted to object, would be:
<object data="{f:uri.image(src: 'xxx')}" type="image/svg+xml">
<img src="{f:uri.image(src: 'xxx')}">
</object>
Unfortunately, I have no idea what to provide as src. {fileReference.uid} only inserts the unique id of the file (a number).
How can I convert the file id to the relative or absolute URI of the picture?
I think the viewhelper attribute treatIdAsReference is what you are looking for.
f:image as well as f:uri:image can handle Files and FileReferences.
It looks like you have a FileReference, so you should add the attribute with value 1
Here is an example with inline notation:
{f:uri.image(src: '{fileReference.uid}', treatIdAsReference:'1')}
The result of this is the path to your file, it can be used in regular HTML-Tags.

How to upload image in selenium webdriver.. element is not visible

ff.findElementByxpath(//object[# id='slPlugin2']).click();
is not recognizing the element.
And also suggest me the way to upload media through webdriver
<table class="imgTable photoTable" cellspacing="0">
<div id="fileUploadControl404" class="fileUpload t-toolbar t-grid-toolbar t-grid-top">
<object id="slPlugin2" width="117" height="32" data="data:application/x-silverlight," type="application/x-silverlight">
<param value="/LMM/ClientBin/FileUpload.xap" name="source">
<param value="Url =https://lmmwipqa.blob.core.windows.net/uploads?se=2013-12-28T07%3A18%3A43Z&sr=c&sp=w&sig=fxuPdwl4huKRISO%2BCPdZIQxh0i5cdnGjWKO8okj2O34%3D, Parent =fileUploadControl404, Caption =Add Photo" name="initParams">
</object>
</div>
//object[# id='slPlugin2']
The above parameter should be within double quotes,i.e., a string should be passed as parameter to findElementByXPath().
The required statement can be rewritten as follows :
ff.findElementByXPath("//object[#id='slPlugin2']").click();
With respect to clicking on invisible elements, the following statement can be used :
(Note : This assumes the page has jQuery on it)
((JavascriptExecutor)driver).executeScript("$('selector_of_element').click();");
For file upload you can refer this.
I think, ff.findElementById("slPlugin2") would be more shorter way to find the element,
but, anyway unfortunatelly, WebDriver will be not be able to handle the elements
inside the Silverlight embeded app.
I'd recomend to get the parent div: ff.findElementById("fileUploadControl404")
Get its coordinates with .getLocation();
Use Java Robot
or Sikuli in order to manipulate the embeded control.

Will iframe in input type hidden being load?

as the title on top will iframe in input type hidden being load when page is loaded?
For ex:
<input type="hidden" value="<iframe width="810" height="415" src="//www.youtube.com/embed/5th14OTyeqU" frameborder="0" allowfullscreen></iframe>" />
No, it won't load.
You can't put html elements inside the value attribute of an input tag like that. Generally speaking (I won't say always, since html is sometimes very, very weird), html attributes cannot contain more html.
If you're looking to prevent the youtube elements actually loading on the screen as you mentioned in your comment, your best bet is to be found in the answers of this question.
You can use the css style='display:none', and an id for your iframe, like this:
<iframe id="youtube" width="810" height="415" src="//www.youtube.com/embed/5th14OTyeqU" style="display:none;" frameborder="0" allowfullscreen></iframe>
<input type="text" id="name"/>
After that, you can use javascript code:
$("#name").focus(function(){
$("#youtube").show();
});
So when you click on the input text field, the iframe should show up (this way you can test if it works).
UPDATE: I think you also need an API for loading that video there, it will not work without that. You can use this link to get more details: YouTube Player API Reference for iframe Embeds

Embed change src with target on link

With an iFrame and a html link, I can use the TARGET property of html links and setting a name for the iframe to change the src of the iframe. This works well...
How can I do this same thing with an embed instead of an iframe?
So i am starting with
<embed name="test1" src="http://www.example.com"></embed>
The embed is inside an object class if that helps.
Any ideas?
Javascript :)
<a onclick="document.getElementById('emb').src='whatever'">Whatever</a>
<a onclick="document.getElementById('emb').src='whatever2'">Whatever2</a>
<embed id="emb" src="default"></embed>
No, you can't. Just use an iframe.

Showing three XMLs on a html page

I want to show three XMLs on a single html page. These XMLs have XSLs associated with them.
Somthing like this:
Is it possible to do so? If yes, how?
P.S.: I'm using Windows XP SP3.
You have many solutions to do this:
Use Ajax to get the xml file (as a string) and then do whatever you want with it.
Use an iframe with Content-Type: text/xml
Use javascript
You could use html/xhtml div tags to devide the page. Into sections you described above.
<html>
<head></head>
<body>
<div height="20%" width="100%">xml1</div>
<div height="80%" width="20%" style="float:left;">xml2</div>
<div height="80%" width="80%" style="float:left;">xml3</div>
</body>
</html>