Dojo's dijit.Editor not editable in Adobe AIR application? - javascript

Maybe someone has some idea what I'm doing wrong here. I'm writing an AIR application and I'm trying to embed a dijit.Editor on my page - I've tried both with a simple:
<div dojoType="dijit.Editor"></div>
And doing it programmaticly:
<div id="editor"></div>
...
// in the onLoad function
var editorwidget = new dijit.Editor({height: '400px'}, 'editor');
editorwidget.startup();
But neither seem to work right. In both cases I see both the toolbar and an appropriately sized IFRAME, but the IFRAME doesn't seem to be loading its content. I've tried forcibly seeing the src param and calling
editorwidget.iframe.contentWindow.location.reload(true);
but all to no effect - Editor.onLoad() never gets called.
I tried manually calling
editorwidget.iframe._loadFunc(editorwidget.iframe.contentWindow);
And that seems to trigger some things to happen - however what it seems to trigger is the disabling of the Editor widget altogether.
I'm sure I'm missing something dumb, but I'm at a loss for what it could be that I'm missing.
Has anyone else used dijit.Editor in an Adobe AIR application (I'm using the latest 2.0 runtime/2.0 RC SDK).

As near as I can tell the problem seems to be that the IFRAME which gets added to the page with an 'src=javascript:...' violates the security sandbox policy in Adobe AIR. I tried setting the src= what it would eventually be if the javascript got executed, but that just doesn't seem to help either. Not sure why that won't work.

Related

JQuery Mobile 1.4.5 does not seem to invoke javascript on ipad

Using JQuery mobile 1.4.5 (https://jquerymobile.com/)
Ironically, everything works on desktop browsers, but I cannot seem to get anything to work when testing on an iPad ...
My stripped down page (HTML) contains the following:
<div data-role="content">
<script src="test.js"></script>
<script>
$( document ).on( 'pagecreate', function( event ) { do_something(); });
</script>
</div>
The file "test.js", contains the following code:
function do_something() {
alert('here in do_something()');
}
When testing on an iPad, all I get is a grey circle with a "spinning comet" rotating around in the circle and the page never even renders (Yes, I tried rebooting the iPad, clearing browser history/data, etc).
On all other browsers, I get the alert.
Ultimately, I am trying to load google maps into the page along with the javascript I need to manipulate various DOM elements as well as manipulate the map -- which I CAN do and is working on all other browsers -- just can't seem to get anything to work when testing on an iPad (I do not know how to view source or console messages via iPad Safari, which makes debugging a nightmare).
ANY suggestions would be helpful.
Thanks in advance.
First of all, you missed some important information like, were "all other browsers" running on your desktop machine or are we talking about other mobile devices? This is extremely important.
As you can see spinner that would mean jQuery Mobile and jQuery are loaded.
If they were successfully running on your desktop computer then you may check these:
Make sure none of your content is running on or from localhost. This will work just fine on desktop computers, but if you try to test it on any other device it will fail.
Make sure you are not using an absolute path in your jQM application, this will also fail on any remote device. I presume something similar may be the case as jQM is not able to show the first page
You will need to use a remote debugging feature. As you are using an iPad I again presume you own a Mac. Follow this tutorial: https://appletoolbox.com/2014/05/use-web-inspector-debug-mobile-safari/ as it is the only fool-proof method where you will find what was wrong. Unfortunately, if you are using Windows machine then you would need to use Chrome and Android device.
There's also a chance, some of your *.js content is loading from localhost or other sources not available to your iPad. This also may be the case as you stated above alert is not triggering on iPad. Which would mean that some major JavaScript has occurred thus blocking the load of other JavaScript content.
And there's one other foolproof method you can use that always helped me in this case. Trim your code to the bare minimum, even if that means you need to remove most of your HTML content and JavaScript. Test it, if it works, start including removed content. First include remote JavaScript content, CSS and similar. Then if it still works, start including actual HTML and code. Sooner or later you will stumble on the problematic code, missing content, or content that was not loaded into your iPad.
Thanks to all who provided some insight...
Turned out it was an external javascript file that contained a try/catch block as:
try {
// code
}
catch {
// code
}
When changed to:
try {
// code
}
catch(err) {
// code
}
... after the change was made, all tests passed !!

CSS completely stopped working on my Blogspot.com site

I've been working on a CSS / HTML drop down navigation for my blogspot.com site. After coding it a few hours I had accidentally closed the tab to find out no matter what or where I tried the CSS on blogspot, the CSS wouldn't work again. Now, the HTML/CSS works anywhere else, just not on blogspot anymore.
These are the things I did:
1. Created a entire new blog under the same account, then applied
html/css
2. Cleared cookies, cache and restarted browser
3. Tried multiple browsers
4. Used stylish extension to override
5. Used console in firefox to edit HTML on other sites and added my
code to see if it worked elseware
6. Used a different computer
7. Used mobile network instead of ISP
Despite doing everything pretty much to get the css/html to work blogspot, it will refuse it now no matter what. I am guessing it is obviously an issues with blogspot.com such as a glitch or bug that I may have now caused. It also shows a lot of CSS code struck out in the styles inspector when you inspect a site via right-click.
I dab in javascript / jquery sometimes and I am wondering if there is a way to force my CSS to force override.
CSS/HTML http://jsfiddle.net/rpksx66u/
My blogspot site: https://vitalintel.blogspot.com/
Im about to pull my hair out.
update: so I moved the css/html/script element to another part of the page and it works. When the element is placed in the Cross-Column's sections in layout, it refuses to use any CSS.

Why doesn't my jQuery/JavaScript work in Safari?

I'm developing a website for a client, and although all jQuery/Javascript code works fine in Chrome (e.g. floating navbar, and smooth scroll when you click a navbar item), none of it seems to work in Safari?
I've looked at other questions on StackOverflow, and the only advice I've found is to use a HTML validator, because Safari can be iffy like that.
Although I'm in the process of doing that now, I have a feeling it's something deeper, because most of the HTML issues revolve around obsolete center tags.
At the moment, the site is up at: http://www.grahamcafe.net23.net/Padre/index.html
If I breakpoint at http://stats.hosting24.com/count.php I do not get the error. It document.writes a new jQuery
Try this in script.js
var myWrite = document.write;
document.write = function(str) {
;// ignore document.write
}
to stop your hoster from wrecking your page with their horrible script. You get what you pay for I believe.
It assumes Safari allows replacing document.write with an anonymous function

Why is the javascript psuedo-protocol not working?

So, I'm trying to run on random websites, to play with the javascript psuedo-protocol.
javascript:alert("testtesttest");
And it never works. I've tried 6 websites, and I have no clue what I'm doing wrong. I've tried googling with little success. I'm using the latest version of firefox, and I have javascript enabled.
Firefox disabled it for security reasons, because people were pasting things they were told to in the address bar.
but it still works, if you trigger it from your javascript code.
And in chrome code, I found many cases, a window is initialized with this kind of protocol.
For example if you visit http://www.w3schools.com/jsref/met_win_settimeout.asp
There will be some inside windows to be opened with
javascript:"<html><body%20style='background:transparent'></body></html>"
then later on, the location.href changed to
http://www.w3schools.com/jsref/met_win_settimeout.asp
Any one knows why this kind of change happens, and why it is allowed?
Does it suggest for layer window, the location of the window can be changed to the main page?

Asp.net ModalPopupExtender flickering during PostBack

I'm working on a web application that requires me to use a modalpopup I recently made within a user control. Everything works as expected, but somehow after a PostBack, and not always, the panel used in the modal flickers (blink) on the screen very briefly.
I have read on dozens of forums saying that I needed to add "display:none;" to the style tag of this panel. This usually "helps", and most of the postbacks don't show the panel, but some do. Seems that the property is being ignored somehow, but I can't find where, how, when.
I have also tried debuging the javascript with firebug, tested all page events and even tried taking a look at the ajax modalpopupextender sourcecode, but couldn't fix this issue.
The browser I HAVE to make this web application work is Mozilla Firefox 3.5.10, that is the current version on the company I work for. This can't be changed due to corporate policies.
Due to quality and user experience issues that arise with this flickering, I leave it as is, so if anyone can help me out I'd appreciate that. I'm also on a rather tight schedule, so any quick help will be appreciated too, as I'm ready to try and test changes on the go.
Please let me know of any doubts or questions.
Thanks in advance.
If your CSS is in an external file, it's possible that the HTML is being loaded and rendered before the CSS is downloaded, causing the flicker. If this is the case, then adding style="display:none" directly to the HTML tag ought to fix it.
The following works for me:
<script type="text/javascript">
window.onbeforeunload = function () {
document.getElementById("PanelDialog").style.display = "none";
}
</script>

Categories