Go figure, I am having issues with IE and was hoping someone might be able to help....
I have a site where visitors will come and sign up for a specific meeting and then I want to be able to generate an appointment for the calendar of their choice; the choices are gmail, yahoo, and outlook. The gmail and yahoo appointments are generated as expected in all browsers, but the outlook appointments work in every browser except IE. Instead of throwing a file save dialog, IE opens a new window and attempts to navigate the url.
I am using the iCalendar jquery library that I modified a bit and building the ics markup in javascript, like this
//build ics markup
var event = makeAppointment(settings);
//render ics markup as outlook appointment
window.open("data:text/calendar;charset=utf8," + escape(event));
function makeAppointment()
{
return 'BEGIN:VCALENDAR\n' +
'VERSION:2.0\n' +
'PRODID:jquery.icalendar\n' +
'METHOD:PUBLISH\n' +
'BEGIN:VEVENT\n' +
'UID:' + new Date().getTime() + '#' +
(window.location.href.replace(/^[^\/]*\/\/([^\/]*)\/.*$/, '$1') || 'localhost') + '\n' +
'DTSTAMP:' + $.icalendar.formatDateTime(new Date()) + '\n' +
(event.url ? limit75('URL:' + event.url) + '\n' : '') +
(event.contact ? limit75('MAILTO:' + event.contact) + '\n' : '') +
limit75('TITLE:' + event.title) + '\n' +
'DTSTART:' + $.icalendar.formatDateTime(event.start) + '\n' +
'DTEND:' + $.icalendar.formatDateTime(event.end) + '\n' +
(event.summary ? limit75('SUMMARY:' + event.summary) + '\n' : '') +
(event.description ? limit75('DESCRIPTION:' + event.description) + '\n' : '') +
(event.location ? limit75('LOCATION:' + event.location) + '\n' : '') +
(event.recurrence ? makeRecurrence(event.recurrence) + '\n' : '') +
'END:VEVENT\n' +
'END:VCALENDAR';
}
You can get the file save dialog to work in IE by adding a "Content-Disposition: attachment" response header. However, this must happen on the server and cannot happen in client-side scripting, since JavaScript cannot modify header information.
See this answer for related details.
Related
Can someone give me references where I can learn about javascript scripting in BIRT reports?
Scenario is, I have a drop down where which contains name of all car companies... Along with it, it has ALL option.
When "ALL" option is selected it should display all the records of all car brands.
Currently when I select individual car names, it works fine.
ALL option is not working.
Here is a code snippet.
if (params["RP_CarCompany_Name"].value == 'ALL') {
this.queryText = this.queryText.replace('DYNAMIC_CARCOMPANY', "'" + 'BMW' + "'," + "'" + 'AUDI' + "'," + "'" + 'JEEP' + "'," + "'" + 'DATSUN' + "'");
} else {
this.queryText = this.queryText.replace('DYNAMIC_CARCOMPANY', "'" + params["RP_CarCompany_Name"].value.join("','") + "'");
}
P.S.: DYNAMIC_CARCOMPANY is a placeholder in SQL query which is something like this
SELECT * FROM CAR_DB WHERE carcompany IN(DYNAMIC_CARCOMPANY);
Thanks for your help in advance.
I have a mobile app built with Cordova.
On one of the button an onclick event triggers a functions supposed to alert the geolocation. I've installed Cordova geolocation API for the project with cordova plugin add cordova-plugin-geolocation from https://cordova.apache.org/docs/en/latest/reference/cordova-plugin-geolocation/#weather
Then I have the functions according to https://cordova.apache.org/docs/en/latest/reference/cordova-plugin-geolocation/#reference
So basicaly my HTML is
<button onclick="getPOS();">CLICK_ME</button>
And my JS is
function getPOS(){
alert("ok");
var onSuccess = function(position) {
alert('Latitude: ' + position.coords.latitude + '\n' +
'Longitude: ' + position.coords.longitude + '\n' +
'Altitude: ' + position.coords.altitude + '\n' +
'Accuracy: ' + position.coords.accuracy + '\n' +
'Altitude Accuracy: ' + position.coords.altitudeAccuracy + '\n' +
'Heading: ' + position.coords.heading + '\n' +
'Speed: ' + position.coords.speed + '\n' +
'Timestamp: ' + position.timestamp + '\n');
};
// onError Callback receives a PositionError object
//
function onError(error) {
alert('code: ' + error.code + '\n' +
'message: ' + error.message + '\n');
}
navigator.geolocation.getCurrentPosition(onSuccess, onError, { timeout: 30000 });
}
When I launch this in my firefox browser, it asks if I want to share location. If I choose to share, it shows the location fine.
Next When I build the app with cordova, when the apk installation is complete, it says the app requires Network connection and Location ..... which is normal and it means everything is properly set.
Then what I do is enable my phones GPS and Internet connextion
PROBLEM : upon clicking the link CLICK_ME on my phone, nothing happens though GPS and internet are enabled.
After the time out is expired, I get the following error :
Code: 3
message: Timeout expired
Any idea what's wrong here ?
Add these lines to manifest file
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION"></uses-permission>
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION"></uses-permission>
It might be missing permissions for Android.
Regards.
I want to get the HTML code of a webpage after it has been modified (similar to one that we see in inspect element tab of a browser) and I want to do it programatically (if possible using python or any other programming language). Can someone suggest how I might be able to proceed with this? I know its possible since browsers are able to do it.
As the server has no access to client window after client-side changes, you have to use client side languages.
In jquery:
var fullCode= "<html>" + $("html").html() + "</html>";
if you want also to include the Doctype:
var node = document.doctype;
var fullCode = "<!DOCTYPE "
+ node.name
+ (node.publicId ? ' PUBLIC "' + node.publicId + '"' : '')
+ (!node.publicId && node.systemId ? ' SYSTEM' : '')
+ (node.systemId ? ' "' + node.systemId + '"' : '')
+ '>';
fullcode += "<html>" + $("html").html() + "</html>";
Thanks to this
Using JQuery you can achieve this by the following code
$(document).ready(function(){
var html = "<html>"+$('html').html()+"</html>";
});
I print more number of pages from html in IE after first time printing that particular web page became unresponsive. I am printing this using the below code,
function printdData(content)
{
var textPopupWindow = window.open('','popup','toolbar=no,menubar=no,width=1,height=1 left=-5000');
textPopupWindow.document.open();
textPopupWindow.document.write(getPrintData(content));
textPopupWindow.document.close();
}
function getPrintData(printData)
{
return "<html moznomarginboxes mozDisallowSelectionPrint>\n" +
"<head>\n" +
"<meta http-equiv=\"X-UA-Compatible\" content=\"IE=8\" />\n" +
"<script>\n" +
"function step1() {\n" +
" setTimeout('step2()', 10);\n" +
"}\n" +
"function step2() {\n" +
" window.print();\n" +
" window.close();\n" +
"}\n" +
"</script>\n" +
"<style type=\"text/css\" media=\"print\">\n" +
"#page \n" +
"{\n" +
"size: auto;\n" +
"margin-top: 0.25in;\n" +
"margin-bottom: 0.25in;\n" +
"}\n" +
"</style>\n" +
"</head>\n" +
"<body onLoad='step1()' style=\"font-size: 12px;\">\n" +
printData +
"</body>\n" +
"</html>\n";
}
This is the code I used to print the html generated content from the web page.
The 'printData' contains the html content going to print. This problem is in IE only but it works fine in chrome and firefox.
IE Specs:
Version: IE 9
OS: Windows 7
Without seeing more details, a full autopsy of the code you've given cannot be performed. Let us know more details about the browser like the following:
IE Version
Operating System ("Windows _" I presume)
In the meantime try disabling all add-ons. That is a common efficiency drain for IE since the advent of add-ons. In addition if that does not solve what you need, try this thread: superuser forum post
I am trying to create email templates just using an html file. This file will display a list of mailto links that, when clicked, will open a template with message. I got it working for the most part but some of these templates use prompts to add information to the message before creating it. The problem is that it doesn't seem to work right. Here is my code.
function sendReport(emailName, addresseList){
document.writeln('<a onClick="setPrompt(this,\'' + addresseList + '\')" href="mailto:' + addresseList + '?subject=' + 'Report' + '&body=' + 'Here is the report.' + '">' + emailName + '</a><br />');
}
function setPrompt(obj, addresseList){
var reportName = prompt("Report name","");
obj.attr('href', ='mailto:' + addresseList + '?subject=' + reportName + '&body=' + "Here is the report."); //<-- this is the line that is giving me trouble.
}
You have a typo in the last line and there is no .attr() built in function in Javascript. This should fix it:
obj.setAttribute('href', 'mailto:' + addresseList + '?subject=' + reportName + '&body=' + "Here is the report.");