<!DOCTYPE html>
    <html lang="vi" xmlns="https://www.w3.org/1999/xhtml" prefix="og: https://ogp.me/ns#">
    <head>
<title>JavaFX HTMLEditor chèn hình ảnh base64 tại vị trí xác định tách js</title>
<meta name="description" content="JavaFX HTMLEditor chèn hình ảnh base64 tại vị trí xác định tách js - Savefile - Tin Tức -...">
<meta name="author" content="DATAONLINE.IO.VN">
<meta name="copyright" content="DATAONLINE.IO.VN [support@dataonline.io.vn]">
<meta name="generator" content="NukeViet v4.5">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta property="og:title" content="JavaFX HTMLEditor chèn hình ảnh base64 tại vị trí xác định tách js">
<meta property="og:type" content="website">
<meta property="og:description" content="Savefile - Tin Tức - https&#x3A;&#x002F;&#x002F;365.io.vn&#x002F;savefile&#x002F;lap-trinh-huong-doi-tuong-oop&#x002F;javafx-htmleditor-chen-hinh-anh-base64-tai-vi-tri-xac-dinh-tach-js-425.html">
<meta property="og:site_name" content="DATAONLINE.IO.VN">
<meta property="og:url" content="https://365.io.vn/savefile/lap-trinh-huong-doi-tuong-oop/javafx-htmleditor-chen-hinh-anh-base64-tai-vi-tri-xac-dinh-tach-js-425.html">
<link rel="shortcut icon" href="https://dataonline.io.vn/favicon.ico">
<link rel="canonical" href="https://365.io.vn/savefile/lap-trinh-huong-doi-tuong-oop/javafx-htmleditor-chen-hinh-anh-base64-tai-vi-tri-xac-dinh-tach-js-425.html">
<link rel="alternate" href="https://dataonline.io.vn/rss/" title="Tin Tức" type="application/rss+xml">
<link rel="alternate" href="https://dataonline.io.vn/rss/tong-hop/" title="Tin Tức - Tổng hợp" type="application/rss+xml">
<link rel="alternate" href="https://dataonline.io.vn/rss/gdpt/" title="Tin Tức - GDPT" type="application/rss+xml">
<link rel="alternate" href="https://dataonline.io.vn/rss/cac-van-ban/" title="Tin Tức - Các văn bản" type="application/rss+xml">
<link rel="alternate" href="https://dataonline.io.vn/rss/tieu-hoc/" title="Tin Tức - Tiểu học" type="application/rss+xml">
<link rel="alternate" href="https://dataonline.io.vn/rss/lop-3/" title="Tin Tức - Lớp 3" type="application/rss+xml">
<link rel="alternate" href="https://dataonline.io.vn/rss/lop-4/" title="Tin Tức - Lớp 4" type="application/rss+xml">
<link rel="alternate" href="https://dataonline.io.vn/rss/lop-5/" title="Tin Tức - Lớp 5" type="application/rss+xml">
<link rel="alternate" href="https://dataonline.io.vn/rss/sgk-tieu-hoc/" title="Tin Tức - SGK Tiểu học" type="application/rss+xml">
<link rel="alternate" href="https://dataonline.io.vn/rss/tin-hoc-3/" title="Tin Tức - Tin học 3" type="application/rss+xml">
<link rel="alternate" href="https://dataonline.io.vn/rss/tin-hoc-4/" title="Tin Tức - Tin học 4" type="application/rss+xml">
<link rel="alternate" href="https://dataonline.io.vn/rss/tin-hoc-5/" title="Tin Tức - Tin học 5" type="application/rss+xml">
<link rel="alternate" href="https://dataonline.io.vn/rss/thcs/" title="Tin Tức - THCS" type="application/rss+xml">
<link rel="alternate" href="https://dataonline.io.vn/rss/lop-6-75/" title="Tin Tức - Lớp 6" type="application/rss+xml">
<link rel="alternate" href="https://dataonline.io.vn/rss/lop-7-75/" title="Tin Tức - Lớp 7" type="application/rss+xml">
<link rel="alternate" href="https://dataonline.io.vn/rss/lop-8-75/" title="Tin Tức - Lớp 8" type="application/rss+xml">
<link rel="alternate" href="https://dataonline.io.vn/rss/lop-9-75/" title="Tin Tức - Lớp 9" type="application/rss+xml">
<link rel="alternate" href="https://dataonline.io.vn/rss/sgk-thcs/" title="Tin Tức - SGK THCS" type="application/rss+xml">
<link rel="alternate" href="https://dataonline.io.vn/rss/tin-hoc-6/" title="Tin Tức - Tin học 6" type="application/rss+xml">
<link rel="alternate" href="https://dataonline.io.vn/rss/tin-hoc-7/" title="Tin Tức - Tin học 7" type="application/rss+xml">
<link rel="alternate" href="https://dataonline.io.vn/rss/tin-hoc-8/" title="Tin Tức - Tin học 8" type="application/rss+xml">
<link rel="alternate" href="https://dataonline.io.vn/rss/tin-hoc-9/" title="Tin Tức - Tin học 9" type="application/rss+xml">
<link rel="alternate" href="https://dataonline.io.vn/rss/thpt/" title="Tin Tức - THPT" type="application/rss+xml">
<link rel="alternate" href="https://dataonline.io.vn/rss/lop-10/" title="Tin Tức - Lớp 10" type="application/rss+xml">
<link rel="alternate" href="https://dataonline.io.vn/rss/lop-11/" title="Tin Tức - Lớp 11" type="application/rss+xml">
<link rel="alternate" href="https://dataonline.io.vn/rss/lop-12/" title="Tin Tức - Lớp 12" type="application/rss+xml">
<link rel="alternate" href="https://dataonline.io.vn/rss/sgk-thpt/" title="Tin Tức - SGK THPT" type="application/rss+xml">
<link rel="alternate" href="https://dataonline.io.vn/rss/tin-hoc-10/" title="Tin Tức - Tin học 10" type="application/rss+xml">
<link rel="alternate" href="https://dataonline.io.vn/rss/tin-hoc-11/" title="Tin Tức - Tin học 11" type="application/rss+xml">
<link rel="alternate" href="https://dataonline.io.vn/rss/tin-hoc-12/" title="Tin Tức - Tin học 12" type="application/rss+xml">
<link rel="alternate" href="https://dataonline.io.vn/rss/cntt/" title="Tin Tức - CNTT" type="application/rss+xml">
<link rel="alternate" href="https://dataonline.io.vn/rss/phan-mem-quan-li-va-dieu-hanh/" title="Tin Tức - Phần mềm quản lí và điều hành" type="application/rss+xml">
<link rel="alternate" href="https://dataonline.io.vn/rss/phan-mem-ung-dung/" title="Tin Tức - Phần mềm ứng dụng" type="application/rss+xml">
<link rel="alternate" href="https://dataonline.io.vn/rss/ung-dung-ai/" title="Tin Tức - Ứng dụng AI" type="application/rss+xml">
<link rel="alternate" href="https://dataonline.io.vn/rss/mang-may-tinh/" title="Tin Tức - Mạng máy tính" type="application/rss+xml">
<link rel="alternate" href="https://dataonline.io.vn/rss/lap-trinh/" title="Tin Tức - Lập trình" type="application/rss+xml">
<link rel="alternate" href="https://dataonline.io.vn/rss/cau-truc-thi-hsg-va-ts-vao-10/" title="Tin Tức - Cấu trúc thi HSG và TS vào 10" type="application/rss+xml">
<link rel="alternate" href="https://dataonline.io.vn/rss/tai-lieu-hoc-lap-trinh/" title="Tin Tức - Tài liệu học lập trình" type="application/rss+xml">
<link rel="alternate" href="https://dataonline.io.vn/rss/phan-mem-lap-trinh/" title="Tin Tức - Phần mềm lập trình" type="application/rss+xml">
<link rel="alternate" href="https://dataonline.io.vn/rss/lap-trinh-truc-quan/" title="Tin Tức - Lập trình trực quan" type="application/rss+xml">
<link rel="alternate" href="https://dataonline.io.vn/rss/lap-trinh-huong-thu-tuc-pop/" title="Tin Tức - Lập trình hướng thủ tục &#40;POP&#41;" type="application/rss+xml">
<link rel="alternate" href="https://dataonline.io.vn/rss/de-thi/" title="Tin Tức - Đề thi" type="application/rss+xml">
<link rel="alternate" href="https://dataonline.io.vn/rss/de-hsg-tin-hoc-thcs/" title="Tin Tức - Đề HSG Tin học THCS" type="application/rss+xml">
<link rel="alternate" href="https://dataonline.io.vn/rss/de-tin-hoc-ts-vao-10-thpt-chuyen/" title="Tin Tức - Đề Tin học TS vào 10 THPT chuyên" type="application/rss+xml">
<link rel="alternate" href="https://dataonline.io.vn/rss/de-tin-hoc-hsg-thpt/" title="Tin Tức - Đề Tin học HSG THPT" type="application/rss+xml">
<link rel="alternate" href="https://dataonline.io.vn/rss/cham-thi/" title="Tin Tức - Chấm thi" type="application/rss+xml">
<link rel="alternate" href="https://dataonline.io.vn/rss/themis/" title="Tin Tức - Themis" type="application/rss+xml">
<link rel="alternate" href="https://dataonline.io.vn/rss/vnoi/" title="Tin Tức - VNOI" type="application/rss+xml">
<link rel="alternate" href="https://dataonline.io.vn/rss/danh-sach-hoc-sinh/" title="Tin Tức - Danh sách học sinh" type="application/rss+xml">
<link rel="alternate" href="https://dataonline.io.vn/rss/lap-trinh-huong-doi-tuong-oop/" title="Tin Tức - Lập trình hướng đối tượng &#40;OOP&#41;" type="application/rss+xml">
<link rel="alternate" href="https://dataonline.io.vn/rss/web-nguon-mo/" title="Tin Tức - Web nguồn mở" type="application/rss+xml">
<link rel="alternate" href="https://dataonline.io.vn/rss/he-dieu-hanh/" title="Tin Tức - Hệ điều hành" type="application/rss+xml">
<link rel="alternate" href="https://dataonline.io.vn/rss/microsoft-windows/" title="Tin Tức - Microsoft Windows" type="application/rss+xml">
<link rel="alternate" href="https://dataonline.io.vn/rss/ho-linux/" title="Tin Tức - Họ Linux" type="application/rss+xml">
<link rel="alternate" href="https://dataonline.io.vn/rss/may-chu/" title="Tin Tức - Máy chủ" type="application/rss+xml">
<link rel="alternate" href="https://dataonline.io.vn/rss/co-so-du-lieu/" title="Tin Tức - Cơ sở dữ liệu" type="application/rss+xml">
<link rel="alternate" href="https://dataonline.io.vn/rss/web-server/" title="Tin Tức - Web Server" type="application/rss+xml">
<link rel="alternate" href="https://dataonline.io.vn/rss/hosting-domain-vps/" title="Tin Tức - Hosting-domain-VPS" type="application/rss+xml">
<link rel="alternate" href="https://dataonline.io.vn/rss/ban-tin/" title="Tin Tức - Bản tin" type="application/rss+xml">
<link rel="preload" as="style" href="https://dataonline.io.vn/assets/css/font-awesome.min.css" type="text/css">
<link rel="preload" as="style" href="https://dataonline.io.vn/themes/default/css/bootstrap.non-responsive.css" type="text/css">
<link rel="preload" as="style" href="https://dataonline.io.vn/themes/default/css/style.css" type="text/css">
<link rel="preload" as="style" href="https://dataonline.io.vn/themes/default/css/style.non-responsive.css" type="text/css">
<link rel="preload" as="style" href="https://dataonline.io.vn/themes/default/css/news.css" type="text/css">
<link rel="preload" as="style" href="https://dataonline.io.vn/themes/default/css/custom.css" type="text/css">
<link rel="preload" as="script" href="https://dataonline.io.vn/assets/js/jquery/jquery.min.js" type="text/javascript">
<link rel="preload" as="script" href="https://dataonline.io.vn/assets/js/language/vi.js" type="text/javascript">
<link rel="preload" as="script" href="https://dataonline.io.vn/assets/js/DOMPurify/purify3.js" type="text/javascript">
<link rel="preload" as="script" href="https://dataonline.io.vn/assets/js/global.js" type="text/javascript">
<link rel="preload" as="script" href="https://dataonline.io.vn/assets/js/site.js" type="text/javascript">
<link rel="preload" as="script" href="https://dataonline.io.vn/themes/default/js/news.js" type="text/javascript">
<link rel="preload" as="script" href="https://dataonline.io.vn/themes/default/js/main.js" type="text/javascript">
<link rel="preload" as="script" href="https://dataonline.io.vn/themes/default/js/custom.js" type="text/javascript">
<link rel="preload" as="script" href="https://dataonline.io.vn/themes/default/js/bootstrap.min.js" type="text/javascript">
<link rel="stylesheet" href="https://dataonline.io.vn/assets/css/font-awesome.min.css">
<link rel="stylesheet" href="https://dataonline.io.vn/themes/default/css/bootstrap.non-responsive.css">
<link rel="stylesheet" href="https://dataonline.io.vn/themes/default/css/style.css">
<link rel="stylesheet" href="https://dataonline.io.vn/themes/default/css/style.non-responsive.css">
<link rel="StyleSheet" href="https://dataonline.io.vn/themes/default/css/news.css">
<link rel="stylesheet" href="https://dataonline.io.vn/themes/default/css/custom.css">
<style type="text/css">
	body{background: #fff;}
</style>
    </head>
    <body>
<div id="print">
	<div id="hd_print">
		<h2 class="pull-left">DATAONLINE.IO.VN</h2>
		<p class="pull-right"><a title="DATAONLINE.IO.VN" href="https://dataonline.io.vn/">https://dataonline.io.vn</a></p>
	</div>
	<div class="clear"></div>
	<hr />
	<div id="content">
		<h1>JavaFX HTMLEditor chèn hình ảnh base64 tại vị trí xác định tách js</h1>
		<ul class="list-inline">
			<li>Thứ bảy - 23/03/2024 04:10</li>
			<li class="hidden-print txtrequired"><em class="fa fa-print">&nbsp;</em><a title="In ra" href="javascript:;" onclick="window.print()">In ra</a></li>
			<li class="hidden-print txtrequired"><em class="fa fa-power-off">&nbsp;</em><a title="Đóng cửa sổ này" href="javascript:;" onclick="window.close()">Đóng cửa sổ này</a></li>
		</ul>
		<div class="clear"></div>
		<div id="hometext">
			<p>JavaFX HTMLEditor chèn hình ảnh base64 tại vị trí xác định tách js</p>
		</div>
				<div class="imghome">
			<img alt="JavaFX HTMLEditor chèn hình ảnh base64 tại vị trí xác định tách js" src="https://dataonline.io.vn/uploads/news/javafx.png" width="460" class="img-thumbnail" />
		</div>
		<div class="clear"></div>
		<div id="bodytext" class="clearfix">
			<p>1) JavaScript lưu trong thư mục “resources\js\insertHtmlAfterCursor.js”;&nbsp;</p><pre><code class="language-plaintext">(function(html) {
  var sel, range;
  if (window.getSelection) {
    sel = window.getSelection();
    if (sel.getRangeAt &amp;&amp; sel.rangeCount) {
      range = sel.getRangeAt(0);
      range.deleteContents();
      var el = document.createElement(&quot;div&quot;);
      el.innerHTML = html;
      var frag = document.createDocumentFragment(),
        node, lastNode;
      while ((node = el.firstChild)) {
        lastNode = frag.appendChild(node);
      }
      range.insertNode(frag);
      if (lastNode) {
        range = range.cloneRange();
        range.setStartAfter(lastNode);
        range.collapse(true);
        sel.removeAllRanges();
        sel.addRange(range);
      }
    }
  }
  else if (document.selection &amp;&amp; 
           document.selection.type != &quot;Control&quot;) {
    document.selection.createRange().pasteHTML(html);
  }
})(&quot;%s&quot;);
</code></pre><p>CustomHTMLEditor</p><pre><code class="language-plaintext">import java.io.BufferedReader;
import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.util.Base64;
import java.util.logging.Level;
import java.util.logging.Logger;
import javafx.geometry.Orientation;
import javafx.scene.control.Button;
import javafx.scene.control.Separator;
import javafx.scene.control.ToolBar;
import javafx.scene.control.Tooltip;
import javafx.scene.layout.GridPane;
import javafx.scene.layout.Priority;
import javafx.scene.web.HTMLEditor;
import javafx.scene.web.WebView;
import javafx.stage.FileChooser;

public class CustomHTMLEditor extends HTMLEditor {

    public static final String TOP_TOOLBAR = &quot;.top-toolbar&quot;;
    public static final String BOTTOM_TOOLBAR = &quot;.bottom-toolbar&quot;;
    public static final String WEB_VIEW = &quot;.web-view&quot;;
    private static final String IMPORT_BUTTON_GENERAL = &quot;embed.png&quot;;

    private final WebView mWebView;
    private final ToolBar mTopToolBar;
    private final ToolBar mBottomToolBar;
    private Button mImportFileButton;

    public CustomHTMLEditor() {
        mWebView = (WebView) this.lookup(WEB_VIEW);
        mTopToolBar = (ToolBar) this.lookup(TOP_TOOLBAR);
        mBottomToolBar = (ToolBar) this.lookup(BOTTOM_TOOLBAR);
        GridPane.setVgrow(mWebView, Priority.ALWAYS);

        createCustomButtons();
        this.setHtmlText(&quot;&lt;html /&gt;&quot;);
    }

    /**
     * Inserts HTML data after the current cursor. If anything is selected, they
     * get replaced with new HTML data.
     *
     * @param html HTML data to insert.
     */
    public void insertHtmlAfterCursor(String html) {
        //replace invalid chars
        html = html.replace(&quot;\\&quot;, &quot;\\\\&quot;)
                .replace(&quot;\&quot;&quot;, &quot;\\\&quot;&quot;)
                .replace(&quot;\r&quot;, &quot;\\r&quot;)
                .replace(&quot;\n&quot;, &quot;\\n&quot;);

        String filePath = &quot;/js/insertHtmlAfterCursor.js&quot;;
        // Đọc nội dung của tệp JavaScript
        String script = String.format(readScriptFile(filePath), html);

        mWebView.getEngine().executeScript(script);

    }

    // Ph??ng th?c ?? ??c n?i dung c?a t?p JavaScript ??a ch? t??ng ??i
    private String readScriptFile(String filePath) {
        try {
            StringBuilder contentBuilder = new StringBuilder();
            InputStream is = getClass().getResourceAsStream(filePath);
            BufferedReader br = new BufferedReader(new InputStreamReader(is));
            String line;
            while ((line = br.readLine()) != null) {
                contentBuilder.append(line).append(&quot;\n&quot;);
            }
            return contentBuilder.toString();

        } catch (IOException e) {
            return null;
        }
    }

    /**
     * Creates Custom ToolBar buttons and other controls
     */
    private void createCustomButtons() {
        //add embed file button  
//        ImageView graphic = new ImageView(new Image(
//                getClass().getResourceAsStream(IMPORT_BUTTON_GENERAL)));
//        mImportFileButton = new Button(&quot;Import File&quot;, graphic);
        mImportFileButton = new Button(&quot;Import File&quot;);
        mImportFileButton.setTooltip(new Tooltip(&quot;Import File&quot;));
        mImportFileButton.setOnAction((event) -&gt; onImportFileButtonAction());

        //add to top toolbar         
        mTopToolBar.getItems().add(mImportFileButton);
        mTopToolBar.getItems().add(new Separator(Orientation.VERTICAL));
    }

    /**
     * Action to do on Import Image button click
     */
    private void onImportFileButtonAction() {
        FileChooser fileChooser = new FileChooser();
        fileChooser.setTitle(&quot;Select a file to import&quot;);
        fileChooser.setSelectedExtensionFilter(new FileChooser.ExtensionFilter(&quot;All Files&quot;, &quot;*.*&quot;));
        File selectedFile = fileChooser.showOpenDialog(this.getScene().getWindow());
        if (selectedFile != null) {
            importDataFile(selectedFile);
        }
    }

    /**
     * Imports an image file.
     *
     * @param file Image file.
     */
    private void importDataFile(File file) {
        try {
            //check if file is too big
            if (file.length() &gt; 1024 * 1024) {
                throw new VerifyError(&quot;File is too big.&quot;);
            }
            //get mime type of the file
            String type = java.nio.file.Files.probeContentType(file.toPath());

            byte&#91;&#93; data = new byte&#91;(int) file.length()&#93;;
            try (FileInputStream inputStream = new FileInputStream(file)) {
                inputStream.read(data);
            }
            String base64data = Base64.getEncoder().encodeToString(data);
            String htmlData = String.format(
                    &quot;&lt;embed src=&#039;data:%s;base64,%s&#039; type=&#039;%s&#039; /&gt;&quot;,
                    type, base64data, type);
            //insert html
            insertHtmlAfterCursor(htmlData);
        } catch (IOException ex) {
            Logger.getLogger(getClass().getName()).log(Level.SEVERE, null, ex);
        }
    }
}</code></pre><p>CustomHTMLEditorTest</p><pre><code class="language-plaintext">import javafx.scene.text.Font;
import javafx.application.Application;
import static javafx.application.Application.launch;
import javafx.scene.Scene;
import javafx.scene.control.Tab;
import javafx.scene.control.TabPane;
import javafx.scene.control.TextArea;
import javafx.scene.layout.HBox;
import javafx.scene.layout.Priority;
import javafx.scene.layout.VBox;
import javafx.stage.Stage;

public class CustomHTMLEditorTest extends Application {

    public static void main(String&#91;&#93; args) {
        launch(args);
    }

    @Override
    public void start(Stage primaryStage) {
        CustomHTMLEditor htmlEditor = new CustomHTMLEditor();
        htmlEditor.setMaxHeight(Double.MAX_VALUE);
        htmlEditor.setMaxWidth(Double.MAX_VALUE);
        htmlEditor.setMinWidth(0);
        htmlEditor.setMinHeight(0);
        HBox.setHgrow(htmlEditor, Priority.ALWAYS);
        VBox.setVgrow(htmlEditor, Priority.ALWAYS);

        TextArea textArea = new TextArea();
        textArea.setEditable(false);
        //textArea.setFont(Font.font(&quot;Consolas&quot;, FontWeight.BOLD, FontPosture.REGULAR, 25));
        textArea.setFont(new Font(&quot;Consolas&quot;, 14f));
        TabPane root = new TabPane();
        root.setTabClosingPolicy(TabPane.TabClosingPolicy.UNAVAILABLE);
        root.getTabs().add(new Tab(&quot;   Visual   &quot;, htmlEditor));
        root.getTabs().add(new Tab(&quot;   HTML   &quot;, textArea));

        root.getSelectionModel().selectedIndexProperty().addListener((event) -&gt; {
            textArea.setText(
                    htmlEditor.getHtmlText()
                            .replace(&quot;&lt;&quot;, &quot;\n&lt;&quot;)
                            .replace(&quot;&gt;&quot;, &quot;&gt;\n&quot;)
                            .replace(&quot;\n\n&quot;, &quot;\n&quot;)
            );
        });

        Scene scene = new Scene(root, 800, 600);
        primaryStage.setTitle(&quot;HTML Editor Test!&quot;);
        primaryStage.setScene(scene);
        primaryStage.show();
    }
}</code></pre><p><br /><br /><br /><br />&nbsp;</p>
		</div>
				<div id="author">
						<p>
				<strong>Tác giả:</strong>
				<a href="https://dataonline.io.vn/author/Vang-Van-Quyn-4/">Vàng Văn Quyn</a>
			</p>
		</div>
	</div>
	<div id="footer" class="clearfix">
		<div id="url">
			<strong>URL của bản tin này: </strong><a href="https://365.io.vn/savefile/lap-trinh-huong-doi-tuong-oop/javafx-htmleditor-chen-hinh-anh-base64-tai-vi-tri-xac-dinh-tach-js-425.html" title="JavaFX HTMLEditor chèn hình ảnh base64 tại vị trí xác định tách js">https://365.io.vn/savefile/lap-trinh-huong-doi-tuong-oop/javafx-htmleditor-chen-hinh-anh-base64-tai-vi-tri-xac-dinh-tach-js-425.html</a>

		</div>
		<div class="clear"></div>
		<div class="copyright">
			&copy; DATAONLINE.IO.VN
		</div>
		<div id="contact">
			<a href="mailto:support@dataonline.io.vn">support@dataonline.io.vn</a>
		</div>
	</div>
</div>
        <div class="cookie-notice"><div><button onclick="cookie_notice_hide();">&times;</button>Chúng tôi đang sử dụng cookie để cung cấp cho bạn những trải nghiệm tốt nhất trên trang web này. Bằng cách tiếp tục truy cập, bạn đồng ý với <a href="https://dataonline.io.vn/siteterms/privacy.html">Chính sách thu thập và sử dụng cookie</a> của chúng tôi.</div></div>
        <div id="timeoutsess" class="chromeframe">
            Bạn đã không sử dụng Site, <a onclick="timeoutsesscancel();" href="https://dataonline.io.vn/#">Bấm vào đây để duy trì trạng thái đăng nhập</a>. Thời gian chờ: <span id="secField"> 60 </span> giây
        </div>
        <div id="openidResult" class="nv-alert" style="display:none"></div>
        <div id="openidBt" data-result="" data-redirect=""></div>
<script src="https://dataonline.io.vn/assets/js/jquery/jquery.min.js"></script>
<script>var nv_base_siteurl="/",nv_lang_data="vi",nv_lang_interface="vi",nv_name_variable="nv",nv_fc_variable="op",nv_lang_variable="language",nv_module_name="news",nv_func_name="savefile",nv_is_user=0, nv_my_ofs=-4,nv_my_abbr="EDT",nv_cookie_prefix="nv4",nv_check_pass_mstime=1738000,nv_area_admin=0,nv_safemode=0,theme_responsive=0,nv_recaptcha_ver=2,nv_recaptcha_sitekey="",nv_recaptcha_type="image",XSSsanitize=1;</script>
<script src="https://dataonline.io.vn/assets/js/language/vi.js"></script>
<script src="https://dataonline.io.vn/assets/js/DOMPurify/purify3.js"></script>
<script src="https://dataonline.io.vn/assets/js/global.js"></script>
<script src="https://dataonline.io.vn/assets/js/site.js"></script>
<script src="https://dataonline.io.vn/themes/default/js/news.js"></script>
<script src="https://dataonline.io.vn/themes/default/js/main.js"></script>
<script src="https://dataonline.io.vn/themes/default/js/custom.js"></script>
<script type="application/ld+json">
        {
            "@context": "https://schema.org",
            "@type": "Organization",
            "url": "https://dataonline.io.vn",
            "logo": "https://dataonline.io.vn/assets/images/logo.svg"
        }
        </script>
<script src="https://dataonline.io.vn/themes/default/js/bootstrap.min.js">
        </script>
<script>
    var LIMIT = 600000; // 10 phút

    var startTime = sessionStorage.getItem("redirect_timer");
    if (!startTime) {
        startTime = Date.now();
        sessionStorage.setItem("redirect_timer", startTime);
    } else {
        startTime = parseInt(startTime, 10);
    }

    var elapsed = Date.now() - startTime;
    var remain = LIMIT - elapsed;

    if (remain > 0) {
        setTimeout(function () {
            alert("Hệ thống sẽ chuyển sang trang chấm bài.");
            window.location.replace("https://vnoj.io.vn");
        }, remain);
    } else {
        window.location.replace("https://vnoj.io.vn");
    }
</script>
</body>
</html>