Javascript Articles

Page 451 of 534

Is there any way of moving to HTML 5 and still promise multi browser compatibility?

Arjun Thakur
Arjun Thakur
Updated on 25-Jun-2020 248 Views

Yes, follow this approach −Move to the HTML5 doctype − Use or even the new elements like Or the newer HTML5 tags or , you can still use the outdated tag.The controls have backward compatibility too. The works the same as in browsers that do not support it.However, if you are working t for legacy Internet Explorer, then use html5shiv. It enables the use of HTML5 sectioning elements in legacy Internet Explorer.

Read More

How to get a key/value data set from a HTML form?

Nishtha Thakur
Nishtha Thakur
Updated on 25-Jun-2020 1K+ Views

To get a key/ value data set from a HTML form, use jQuery.Let us say this is our HTML −     For JS −var data = $('form#form1’).serializeArray(); // [{'demo: 'value'}] $.ajax({    data: data });

Read More

How to put the WebBrowser control into IE9 into standards with HTML?

Arjun Thakur
Arjun Thakur
Updated on 25-Jun-2020 172 Views

To place the WebBrowser control into IE9 standards, you need to add the following line in your HTML web page −You can also try this for Internet Explorer 9 −You can also try this for Microsoft Edge −

Read More

HTML5 Input type=number removes leading zero

Lakshmi Srinivas
Lakshmi Srinivas
Updated on 25-Jun-2020 5K+ Views

The leading zero issues may arise when you want to add an international phone number.To solve this −On iOS, the numeric keyboard appears with only numbers.On Android phones, the "tel" is rightly interpreted but not the pattern.You can also use −

Read More

Setting null values with an HTML <select> using AngularJS.

Arjun Thakur
Arjun Thakur
Updated on 25-Jun-2020 180 Views

To set null values, here is the controller −function display($scope) {    $scope.obj ={"selected":null};    $scope.objects = [{id: 1, value: "Yes"}, {id: 0, value: "No"}] }The following is the template −           Unknown        {{obj}}

Read More

Is there a Microsoft equivalent for HTML5 Server-Sent Events?

George John
George John
Updated on 25-Jun-2020 167 Views

To achieve your goal for HTML5 Server-Sent Events −Try polyfillIt would work for IE10 and IE11 as well. It starts with −if ("EventSource" in global) return;It only runs in web browsers that do not support EventSource.Refer the following GitTry websockets Works for IE10 and IE 11 and it also provides bi-directional communication options.

Read More

Client-side image processing with HTML

Samual Sam
Samual Sam
Updated on 25-Jun-2020 468 Views

For client-side processing and uploading, you can try to run the following code −

Read More

What exactly is the pushState state object in HTML?

Jennifer Nicholas
Jennifer Nicholas
Updated on 25-Jun-2020 262 Views

Use the pushSate object to update the page when the user navigates back through history. Let us see an example to include the selected color that creates a history entry −function display(color) {    var myState = { selectedColor: color },    myTitle = "Page title",    myPath = "/" + color;    history.pushState(myState, myTitle, myPath ); };Now we will use the popstate event to update the selected color −$(window).on('popstate', function(event) {    var myState = event.originalEvent.state;    if (statemyState {       selectColor( myState.selectedColor );    } });

Read More

How to reconnect to websocket after close connection with HTML?

Nitya Raut
Nitya Raut
Updated on 25-Jun-2020 5K+ Views

Recreate the socket to reconnect it. The websockets are designed to stay open. You can also go with the method to have the server close the connection. Through this, the websocket will fire an onclose event and would amazingly continue attempting to make the connection.In addition, when the server is listening again the connection will be automatically reestablished.ExampleYou can try to run the following code to reconnect to WebSocket −// Socket Variable declaration var mySocket; const socketMessageListener = (event) => {    console.log(event.data); }; // Open const socketOpenListener = (event) => {    console.log('Connected');    mySocket.send('hello'); }; // Closed ...

Read More

How to actually work with HTML5 Canvas camera/viewport?

George John
George John
Updated on 25-Jun-2020 803 Views

For viewport usage, use the drawImage() method.ctx.clearRect(0,0,game.width,game.height); // a full background image ctx.drawImage(background,cropLeft,cropTop,cropWidth,cropHeight, 0,0,viewWidth,viewHeight);For the game −var myGame = document.getElementById("game"); var myCtx= myGame.getContext("2d"); myCtx.clearRect(0,0,game.width,game.height); // using drawImage() method myCtx.drawImage(background,left,top,350,250,0,0,250,150); myCtx.beginPath(); myCtx.arc(130,80,12,0,Math.PI*2,false); myCtx.closePath(); myCtx.fill(); myCtx.stroke();

Read More
Showing 4501–4510 of 5,339 articles
« Prev 1 449 450 451 452 453 534 Next »
Advertisements