I have a modal window for the contact form with a link on the sidebar of my site:
<strong>Click to contact us</strong>
While it works perfectly on every other pages, it doesn't work on the home page. Try clicking it and it won't open the modal window.
The function openDialog() is defined in global.js:
function openDialog() {
jQuery("a#inline").trigger('click')
}
I don't know why. And I don't know how to debug JavaScript. It has no errors displayed whatsoever. Can you help me debug this and also let me know how I can debug it myself in future?
Thanks!
Suppose that you are using a kind of wordpress plugin named like "modal dialog". It seems like this plugin not well install on your home page but other pages, so check the plugin setup of all the layouts include the one used by home page.
<a id="contactLink" href="/contact-us/" style="color:#e40" > <strong> Click to contact us </strong> </a>
Inside your script file:
var contactlink = document.getElementById('contactLink')
contactLink.onclick = openDialog;
Would be a lot easier to debug if you didn't have CSS & Javascript mixed in with your markup. Separating everything (at least during production) is a good practice.
Get the Firebug Addon for FireFox. That's a good tool for debugging javascript. Also, you can hit F12 in your browser and the native development tools will come up.
Related
trying to create a new window (as a pop-up) using JavaScript, the context menu of the new window has the options:
"Save as...",
"View page source",
"View page info"
disabled in Chrome, Opera and IE (11) but it works fine for Firefox.
I am doing so using the instructions:
var j = window.open(myUrl);
j.document.write("<!DOCTYPE html><html><head><title>my page</title></head><body> <p> ciao sample new page </p> </body> </html>");
j.document.close();
The same code was working in our system which was using html 4, now the whole architecture has been passed to html5.
I guess is something related to a security issue but why it does work in Firefox? How can I make that options stil available without writing a custom context menu? Could be a new html5 issue? Am I doing something wrong in the above code?
Thank you
I fixed just using window.open(myPage);
more precisely I had a POST calling via JS and then I was writing the server response using window.write() which caused the problem to me. (anyway the sample I wrote above does not work even in a simple html page with a bit of JS to me).
So I left the POST method that save the page server side, then response returns the id of the html page I wanted to render and then I did:
window.open("myUrl?pageId=" + response.serverResponse.responseText, 'myPage');
which works fine to me without writing other code.
Thank you
I have tried the same code using HTML 4.0 and it worked the same way. I think that this is because of the way view source is handled in Chrome and the other mentioned browsers. In these browsers a refresh is made before view source operations and this is by design. If you want to view source, you can inspect element and it should work fine. It is not a security issue I believe. Can you post the exact HTML 4.0 code that used to be working and that is not working now?
I have an OOB silverlight application. I have Silverlight 5 developer runtime and all the silverlight 5 developer tools installed. The OOB Application has a silverlight view with a WebBrowser control on it. The Source that of webBrowser control is this aspx page:
<head>
<title></title>
<script type="text/javascript" language="javascript">
function test() {
if (hiddenDiv.style.display == "none")
hiddenDiv.style.display = "block";
else
hiddenDiv.style.display = "none";
}
function handCursor() {
clickTest.style.cursor = "hand";
}
function defaultCursor() {
clickTest.style.cursor = "default";
}
</script>
</head>
<body>
<form id="form1" runat="server">
<div>
<%--This Link Doesn't Work--%>
Javascript Href test</br>
<%--This Link Works--%>
<a id="clickTest" onclick="test()" onmouseover="handCursor()" onmouseout="defaultCursor()" style="text-decoration: underline; color:Blue">OnClick Test</a>
<div id="hiddenDiv" style="display:none; background-color:Black">
<span style="color:White; display:inherit">Look at me!</span>
</div>
</div>
</form></body>
(Note: Yes I know the above code is not complete HTML. I could not get the editor to display the full page properly. I cut off the html tags. Also note that this is just a test page, not the real page I want to display in my app. I was just trying to isolate the problem).
When the above code is run in IE9 it works just fine. The links make the Div called "hiddenDiv" hide and show. When it is displayed in a WebBrowser control in a silverlight app it works fine on another developer's machine, but on my machine it does not. I click the link and nothing happens. It appears that the javascript simply does not execute. It appears to only have this issue using the href=javascript method. onclick works great. Unfortunately I don't own the pages i want to display in my app and cannot change the code.
A co-worker of mine believes that this issue might be due to my mistakenly installing the standard silverlight 5 runtime before realizing my mistake and installing the developer runtime. Even though I have since removed the offending file and reinstalled the Silverlight5 Tools.exe. In fact I uninstalled and re-installed all silverlight related products (except VS 2010) and uninstalled IE 9. All to no avail.
If anyone has any additional information on this problem please let me know. We need a solution that does not involve modifying the html. I dont control that html. I am hoping to embed an external web application in my OOB SL application by simply displaying it in a web browser control inside my application.
I discovered the answer to this issue on this thread:
FEATURE_SCRIPTURL_MITIGATION
The issue is a registry setting that turns elements of javascript execution on and off. It is also described in this MSDN Article:
My problem is not about fixing an issue with a certain IDE, in this case Delphi, but is about finding out the problem that leads to the issue. You probably know that in Delphi 2010 (maybe also in some earlier versions) there's a welcome page that lists recently opened projects. It's actually an html page that also involves some js files to load menus and stuff. But recently my welcome page does not work. It does not list any menus and projects and appears like an erroneus page. I've uninstalled and reinstalled Delphi many times but the problem persists. It seems there's a problem with running some JavaScript command,which I think because of the Windows, not Delphi. Here's how the Welcome Page now looks like
Try to right click and select "browse mode" or something alike. It's a known bug, sometimes it enters "edit mode" and doesn't display correctly. IIRC there's an Hausladen IDE fix pack that corrects it.
Though I've embedded the Add to Timeline social plugin in button mode:
<div class="fb-add-to-timeline" data-show-faces="false" data-mode="button"></div>
it keeps showing up as the full plugin including a preview of how Timeline items will look like. Is this a known issue?
I grabbed the embed code from here: https://developers.facebook.com/docs/reference/plugins/add-to-timeline/#.
I had the same issue, and just remove the "timeline" permission from my app settings, and then it showed up.
Since the button is really just a permission trigger you can build around it with your actual access request. This is logical if you are doing an SDK call of all sort using javascript, php or other versions.
Of course as timeline is not enabled outside of dev, one would suspect this will be addressed soon as so far I'm seeing the box in just about any type of testing I do. Odds are Facebook wants to show the box when someone calls timeline specifically to build adoption understanding.
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>