I'm making an html autorun, loading it with default browser has lots of issues, rendering inconsistencies, and more issues when it's loaded internet explorer like users has to click on allow at the top when some javascript is loaded etc. What is the best solution to create a small standalone app with just a full browser control in it which will load an html file say index.html from the application path.
That is if I have browser.exe in a cd, it will load index.html from the cd directory. The browser should be based webkit or Gecko. So far i have been using xulrunner... but its a overkill especially when the file to load is just few kbs. Its using lot of system resources.
I have experience in vb.net(but it requires the .net framework) and php on windows. And basic python, c and javascript. Where should i start and what are your suggestions?
Update:
This is meant to be a wrapper or a chromeless browser that will load the html. So the only functionality needed is autorun and load the html in full screen, thats it! So air, .net etc wont do the work. It should be an standalone exe.
As no answer for this, I will post how you can use XULRunner for this purpose.
Getting Started etc could be found here.
I'm just putting my layout code in which how I achieved a chrome less browser window that
loads my particular page for autorun purpose.
<?xml version="1.0"?>
<?xml-stylesheet href="chrome://global/skin/" type="text/css"?>
<window id="main" title="Edusoft" hidechrome="true" sizemode="maximized" xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
<!--This Sets the browser control and loads index.html and sets clip menu as the popup menu -->
<browser id="1" type="content" src="chrome://myapp/content/theme1/index.html" flex="1" context="clipmenu"/>
<!-- Clips menu -->
<popupset>
<menupopup id="clipmenu">
<menuitem label="Go Back" oncommand="document.getElementById('1').goBack()"/>
<menuseparator/>
<menuitem label="About" oncommand="" />
<menuseparator/>
<menuitem label="Exit" oncommand="close();" />
</menupopup>
</popupset>
</window>
This is the window that loads first when XULRunner is run. It's defined in prefs.js
Thing will be clear when you read through this.
Related
I am using AEM 6.2 and trying to create a parsys component in crx, using the code below
However, the height of this parsys, in edit mode, comes as 0px.
Attached are the screenshots.
When I manually change the height to some values eg. 40px, it looks fine.
Note: I am not using any client library for the above page. (no css and js)
Futher, All sample sites like geomatrix etc have parsys showing correctly.
Could anyone guide me with what I am doing wrong?
I think that the problem is outside the component or any of the code shown here.
I think what's happening is that the css style for the div that gives the droptarget placeholder its dimensions is not loading.
That's loaded as part of the AEM authoring client libraries which you should be inheriting from the foundation page component.
Examine your page component's sling:resourceSuperType property. It should point to either wcm/foundation/components/page or wcm/foundation/components/page or inherit from a component that does.
If that is set then you have may have blocked one of the scripts within it, quite possibly head.html.
Include following code in the head section of the page component's rendering script.
<!--/* Include Adobe Dynamic Tag Management libraries for the header
<sly data-sly-include="/libs/cq/cloudserviceconfigs/components/servicelibs/servicelibs.jsp" data-sly-unwrap/>
*/-->
<!--/* Initializes the Experience Manager authoring UI */-->
<sly data-sly-include="/libs/wcm/core/components/init/init.jsp" data-sly-unwrap/>
For resolving your issue, you need to include init.jsp in the first before writing down the parsys code. I mean write like this.
<head>
<sly data-sly-include='/libs/wcm/core/components/init/init.jsp' />
</head>
<body>
<sly data-sly-resource="${'par' #resourceType='foundation/components/parsys'}" />
</body>
I think #l-klement pointed it out correctly that the problem is outside component. When I rename the landingpage.html file to body.html it starts working fine. I think this may be because of different files like head.html etc present at wcm/foundation/components/page which is required to provide proper styling and load certain required client libraries which assigns proper styling to parsys.
If the above is true, my next question would be, How can I have my own head.html, body.html, header.html, footer.html etc files without compromising with the parsys styling?
I have created a file upload function which saves all the uploads to a certain place:
private String destination = "D:/Documents/NetBeansProjects/FileUpload/uploadedDocuments/";
Is this a good place to store it? Should I store it some where else?
Is it possible that once the upload is complete for a page to be displayed showing the user what they have just uploaded, like a box below showing a preview? And how would I go about doing this? I am new.
I have figured it out how to display a plain txt file and an image, however it is the pdf that is confusing me.
As to the upload location, which seems to be the IDE project folder, that's absolutely not right. You should choose a configureable and fixed location somewhere outside the IDE project folder. You should not rely on using getRealPath() or relative paths in java.io.File. It would make your webapp unportable. See also this related question: Uploaded image only available after refreshing the page.
Whatever way you choose based on the information provided in the answer of the aforementioned question (and all links therein), you should ultimately end up having a valid URL pointing to the PDF file in question such as http://example.com/files/some.pdf.
Then, you can serve the PDF file on a webpage using either an <iframe>:
<iframe src="/files/some.pdf" width="600" height="400"></iframe>
Or an <object>:
<object data="/files/some.pdf" type="application/pdf" width="600" height="400">
some.pdf <!-- This link will only show up when the browser doesn't support showing PDF. -->
</object>
Keep in mind that showing PDFs in a browser is only supported in browsers having Adobe Reader plugin. Note that the <object> approach will gracefully degrade to a link when the browser doesn't support displaying application/pdf content.
I was wondering if it is possible to create a new XUL component via any available api, such as XPCOM or NPAPI, so we can use it our XUL files.
Let's say I wanted to clone the XULs vbox's components code and add a few modifications to it, so we could use our custom XUL component just like this:
<window>
<myvbox mycustomarg1="customValue"> Some content... </myvbox>
</window>
I know what XBL is and what is used for and it doesn't fit our need.
Any suggestion of how to achieve that?
Edit:
We need to create a browser component in Firefox as child of another browser object. The problem is some websites detect this child browser as iframe and we want to avoid this.
Thanks.
If the point is preventing a webpage loaded into a frame from messing with your XUL document then you should use <browser type="content"> - this establishes a security boundary between chrome and content which (among other things) prevents the content document from accessing its parent frame. It is important however that your XUL document itself is loaded as chrome and not content (by either being on top level or inside <browser type="chrome">). See https://developer.mozilla.org/en/XUL/Attribute/browser.type for documentation.
Following this tutorial I was able to retrieve data form the clipboard.
But I have no idea (nither there's something in the API) about how to insert my string into the xul browser (say, when the user open the 'edit' menu and click 'paste').
Any idea?
--update
There's a cmd_paste here, but there's no hint if I can (and how to) use it to paste in a browser. Also the browser's API available documentation have nothing about.
I tried make it work creating a browser, setting the command attribute (not sure if it exists, the API says nothing, but it's a wiki not much reliable) and a button to paste:
<?xml version="1.0"?>
<?xml-stylesheet href="chrome://global/skin/" type="text/css"?>
<window width="400" height="300"
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
<browser id="mybrowser" command="cmd_paste" type="content" src="http://www.google.com/" flex="1" />
<button label="TEST PASTE" command="document.getElementById('mybrowser').doCommand();" />
</window>
Nothing happens when I press the button (with data on my clipboard, and a text field selected inside the browser).
--in the xulrunner source
within toolkit.jar, at content/global/editMenuOverlay.xul there's the definition:
<command id="cmd_paste" oncommand="goDoCommand('cmd_paste')"/>
but no "goDoCommand" method is defined there, nither in the only javascript file included: editMenuOverlay.js.
Do you really need a "paste" command? Couldn't you just retrieve the data from the clipboard using the tutorial you found and copy it into the currently focused text elements when the past button is pressed?
After finding the goDoCommand (see the question update) I found out that the function was in the globalOverlay.js file.
So I added to my Xul:
<script type="application/x-javascript" src="chrome://global/content/globalOverlay.js" />
and used the goDoCommand command.
Not yet sure if it's the best or even correct approach to add this js to my Xul, but look likes ok.
How can I add sound to a web site . I don't want to show .swf player in the page .music should play in the background
You can use the <audio> tag, but check if that is supported in all browsers you are interested in. If not, you can use an invisible swf.
But I'd recommend you not to putting background sound into the site, it tends to be really annoying.
Hide the div element inside which you put the swf object, in the page. Set the display state to none instead of block. Something Like :
<div style="display:none;">
<Your swf object>
</div>
It's old but it works.
9 Versions to play a sound on a web page
I've used version 8 "Using a Java Applet called from JavaScript" for firefox and IE8.